Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Eduardo #1
Member since Sep 2020 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: XmppXElementStreamObserver does not trigger with new messages
Dear all,

I am trying to use the XmppXElementStreamObserver to get new messages but its does not working.

This is my code:

  1. client.XmppXElementStreamObserver
  2.     .Where(el => el is Matrix.Xmpp.Client.Message)
  3.     .Subscribe(el =>
  4.     {
  5.         MessageBox.Show(el.ToString());
  6.     });
  7.  
  8. I tried this too:
  9.  
  10. client.XmppXElementStreamObserver
  11.     .Subscribe(el =>
  12.     {
  13.         MessageBox.Show(el.ToString());
  14.     });

The another user is receiving my messages without problems but I am not seeing the response.

I am using the Matriz.vNext v2.4.5.

What is the problem?
This post was edited on 2020-09-30, 17:55 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I am not sure what your problem is. Have you tried to run the sample from here which also shows howto subscribe to stanzas?
https://github.com/matrix-xmpp/matrix-vnext/blob/master/ex…
Eduardo #3
Member since Sep 2020 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

Yes! I tried exactly like that (just changed Message to Matrix.Xmpp.Client.Message).

I am just getting elements like <stream>, <proceed>, <challenge>, <success>, etc in connection process. After that, I send a message to another user and then he sends me the responde but the XmppXElementStreamObserver dont trigget that.

Thanks
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
are you sure that you are getting the message over the wire at all?
Have you enabled the raw Xml logs and looked at them?

When you have the logs then please post or attach them.

Alex
Eduardo #5
Member since Sep 2020 · 5 posts
Group memberships: Members
Show profile · Link to this post
How can I enable the logs?
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
see here:
https://matrix-xmpp.io/docs/logging/
Avatar
Alex #7
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
But you were also saying that this handler:
  1. client.XmppXElementStreamObserver
  2.     .Subscribe(el =>
  3.     {
  4.         MessageBox.Show(el.ToString());
  5.     });

give you many other elements.
This handler should also return all <message/> elements to you. If it doesn't then you probably never received and and something is going wrong on the server side or on your server.

Alex
Eduardo #8
Member since Sep 2020 · 5 posts
Group memberships: Members
Show profile · Link to this post
Alex,

I think I found the problem.

I am getting an auth error when I try to regiter on the server.

Using this code, I received an auth error:

  1. client.HostnameResolver = new StaticNameResolver(hostname, 5222);
  2. client.RegistrationHandler = new RegisterAccountHandler(client);

Without this code I can send messages without problem.

Do you have any idea about it?

My RegisterAccountHandler class is exactly the same of this link:
https://matrix-xmpp.io/docs/register-account/
Avatar
Alex #9
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Without any logs I cannot tell you whats going wrong when you try to register. You should be able to see the errors in your XML logs.
Eduardo #10
Member since Sep 2020 · 5 posts
Group memberships: Members
Show profile · Link to this post
Follow the logs

  1. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="localhost" id="9aowhumcuq" xml:lang="en" version="1.0" />
  2. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  3.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  4.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  5.     <mechanism>PLAIN</mechanism>
  6.     <mechanism>ANONYMOUS</mechanism>
  7.     <mechanism>SCRAM-SHA-1</mechanism>
  8.     <mechanism>CRAM-MD5</mechanism>
  9.     <mechanism>DIGEST-MD5</mechanism>
  10.  </mechanisms>
  11.  <compression xmlns="http://jabber.org/features/compress">
  12.     <method>zlib</method>
  13.  </compression>
  14.  <ver xmlns="urn:xmpp:features:rosterver" />
  15.  <register xmlns="http://jabber.org/features/iq-register" />
  16.  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://www.igniterealtime.org/projects/openfire/" ver="CjLJjlHxlrvQdXl/ZJ+0adQpkhM=" />
  17. </stream:features>
  18. <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  19. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="localhost" id="9aowhumcuq" xml:lang="en" version="1.0" />
  20. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  21.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  22.     <mechanism>PLAIN</mechanism>
  23.     <mechanism>ANONYMOUS</mechanism>
  24.     <mechanism>SCRAM-SHA-1</mechanism>
  25.     <mechanism>CRAM-MD5</mechanism>
  26.     <mechanism>DIGEST-MD5</mechanism>
  27.  </mechanisms>
  28.  <compression xmlns="http://jabber.org/features/compress">
  29.     <method>zlib</method>
  30.  </compression>
  31.  <ver xmlns="urn:xmpp:features:rosterver" />
  32.  <register xmlns="http://jabber.org/features/iq-register" />
  33.  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://www.igniterealtime.org/projects/openfire/" ver="CjLJjlHxlrvQdXl/ZJ+0adQpkhM=" />
  34. </stream:features>
  35. <iq type="error" id="KsZ+H7e1GEOQ05VHRO71Ug" from="[SERVES_ADDR]" to="localhost/9aowhumcuq" xmlns="jabber:client">
  36.  <query xmlns="jabber:iq:register" />
  37.  <error code="400" type="modify">
  38.     <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  39.  </error>
  40. </iq>
This post was edited on 2020-09-30, 22:54 by Alex.
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this log is incomplete. Looks like its only the incoming XML, but not the outgoing.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: