Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
phbrt #1
Member since Jun 2016 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: First message sends, second doesn't. Disconnecting perhaps?
Hi,

Could you give me some kind of idea as to why the first message will send but not the second? Why do I have to connect to the server once in order to send a message? Why can’t I connect to the server and send multiple messages? It seems like it isn’t keeping the connection alive. If you can give me any ideas I would appreciate it.

  1. Dim msg As New Matrix.Xmpp.Client.Message
  2. msg.Type = MessageType.chat
  3. msg.[To] = targetid
  4. msg.[Body] = json
  5.  
  6.  
  7. MsgBox("first message")
  8. xmppClient.Send(msg) ‘this sends and works correctly
  9. MsgBox("next message")
  10. xmppClient.Send(msg) ‘it wont send the message again without first reconnecting to the server.
This post was edited on 2016-06-04, 11:21 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can send as many messages as you want while you are connected to the server.
if your first or second message has no errors I see no reason why it shouldn't be sent.

Take a look at your debug Xml as described here:
http://www.ag-software.net/matrix-xmpp-sdk/matrix-develope…

maybe the server disconnects you because there is something wrong with message 1. You can also attach your complete Debug Xml here.

Alex
Avatar
phbrt #3
Member since Jun 2016 · 3 posts
Group memberships: Members
Show profile · Link to this post
Does any of this give you any ideas as to why it's disconnecting after the first message successfully sends? I don't understand how the message could be invalid if the first one sends. Does anything stick-out at you?

  1. Sent XML:
  2. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.mysite.com" version="1.0" >
  3. Received XML:
  4. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="2506072853" from="chat.mysite.com" version="1.0" xml:lang="en" >
  5. Received XML:
  6. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  7.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  8.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  9.     <mechanism>PLAIN</mechanism>
  10.  </mechanisms>
  11.  <amp xmlns="http://jabber.org/feature/amp" />
  12.  <sm xmlns="urn:xmpp:sm:3" />
  13. </stream:features>
  14. Sent XML:
  15. <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  16. Received XML:
  17. <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  18. Sent XML:
  19. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.mysite.com" version="1.0" >
  20. Received XML:
  21. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="1814659660" from="chat.mysite.com" version="1.0" xml:lang="en" >
  22. Received XML:
  23. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  24.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  25.     <mechanism>PLAIN</mechanism>
  26.  </mechanisms>
  27.  <amp xmlns="http://jabber.org/feature/amp" />
  28.  <sm xmlns="urn:xmpp:sm:3" />
  29. </stream:features>
  30. Sent XML:
  31. <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">FOO</auth>
  32. Received XML:
  33. <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  34. Sent XML:
  35. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.mysite.com" version="1.0" >
  36. Received XML:
  37. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="3016682559" from="chat.mysite.com" version="1.0" xml:lang="en" >
  38. Received XML:
  39. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  40.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  41.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  42.  <amp xmlns="http://jabber.org/feature/amp" />
  43.  <sm xmlns="urn:xmpp:sm:3" />
  44. </stream:features>
  45. Sent XML:
  46. <iq id="MX_1" type="set" xmlns="jabber:client">
  47.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  48.     <resource>MatriX</resource>
  49.  </bind>
  50. </iq>
  51. Received XML:
  52. <iq id="MX_1" type="result" xmlns="jabber:client">
  53.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  54.     <jid>77768416@chat.mysite.com/MatriX</jid>
  55.  </bind>
  56. </iq>
  57. Sent XML:
  58. <iq id="MX_2" type="set" xmlns="jabber:client">
  59.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  60. </iq>
  61. Received XML:
  62. <iq type="result" id="MX_2" xmlns="jabber:client">
  63.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  64. </iq>
  65. Sent XML:
  66. <iq id="MX_3" type="get" xmlns="jabber:client">
  67.  <query xmlns="jabber:iq:roster" />
  68. </iq>
  69. Received XML:
  70. <iq from="77768416@chat.mysite.com" to="77768416@chat.mysite.com/MatriX" type="error" id="MX_3" xmlns="jabber:client">
  71.  <query xmlns="jabber:iq:roster" />
  72.  <error code="503" type="cancel">
  73.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  74.  </error>
  75. </iq>
  76. Sent XML:
  77. <message type="chat" to="77607384@chat.mysite.com" xmlns="jabber:client">
  78.  <body>{"targetProfileId":"77607384","type":"text","messageId":"A745EA69-74BF-45B7-B027-B5A008174919","timestamp":"1465043423054","sourceDisplayName":"","sourceProfileId":"77768416","body":"Hi"}</body>
  79. </message>


Could the problem be that "/MatriX" is being appended to the recipient address for some reason? How could I prevent it from doing this?
This post was edited 2 times, last on 2016-06-04, 20:46 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The first error in your log is when MatriX requests the contact list from your server.

  1. <iq from="77768416@chat.mysite.com" to="77768416@chat.mysite.com/MatriX" type="error" id="MX_3" xmlns="jabber:client">
  2.  <query xmlns="jabber:iq:roster" />
  3.  <error code="503" type="cancel">
  4.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  5.  </error>
  6. </iq>

the server replies with an unavailable error which is very strange. I assume that something is wrong with your server setup.
Have you tested with any other public servers?
In your Xml log I see only 1 message send, and there are no errors listed.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #3
Quote by phbrt:
Could the problem be that "/MatriX" is being appended to the recipient address for some reason? How could I prevent it from doing this?

No, sending to a bare Jid is fine, the server then routes the packet to the "most available resource" of this user.

Alex
Avatar
phbrt #6
Member since Jun 2016 · 3 posts
Group memberships: Members
Show profile · Link to this post
Well, after messing with this all morning and afternoon, it turns out that setting AutoRoster to False keeps the connection alive. All is well now.
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: