Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Regis #1
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Upgrading from AGS_XMPP to MATRIX
Hi,

I am working on evaluating an upgrade of our source code to use Matrix instead of AGS_XMPP.

So far, I've manage to Login without too much problem, but when I try to subscribe to a node, I get disconnected by the Xmpp server.

Here is the XML that is working (using AGS) :

using PubSubManager.Subscribe(pubsubUrl, mainJid, mainJid, noeud);

  1. XML OUT messages <iq id="agsXMPP_19" type="set" to="pubsub.appli-c14-rec2s00.xxx.fr" from="gen1104n@appli-c14-rec2s00.xxx.fr/messages">
  2. <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <subscribe node="/CRC/ARV/DOU/EQ01/CM_CRC_EASITEAM/Msg" jid="gen1104n@appli-c14-rec2s00.xxx.fr/messages" />
  4. </pubsub>
  5. </iq>

Here is the XML that is not working (using Matrix) :

using : PubSubManager.Subscribe(pubsubUrl, noeud, mainJid);

  1. XML OUT messages <iq id="MX_7" to="pubsub.appli-c14-rec2s00.xxx.fr" type="set" xmlns="jabber:client">
  2.  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  3.     <subscribe node="/CRC/ARV/DOU/EQ01/CM_CRC_EASITEAM/Msg" jid="gen1104n@appli-c14-rec2s00.xxx.fr/messages" />
  4.  </pubsub>
  5. </iq>
I'm get a OnStreamError from the Xmpp client con with the following XML :

args.Error =
  1. <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  2.  <invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
  3. </stream:error>

Why is there no more the "from" tag in the subscribe ?
Could the extra xmlns="jabber:client" cause a problem ?

Any idea why I would receive "InvalidXml" ?

Thanks in advance for your help.

Régis
This post was edited 2 times, last on 2021-01-07, 07:09 by Regis.
Avatar
Alex #2
Member since Feb 2003 · 4397 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

the from tag is never required when you send packages as a client. Its always the server which stamping your package with the correct from address on your behalf.
I do not see any difference on your xml output for this package, and I so not see any invalid XML there.
The extra xmlns="jabber:client" does not go over the wire. Its only there when we look at single stanzas which are not attached to a stream header.

  • Are you sure that the error is coming from this packet?
  • When are you sending this packet in your session? Is it possible that you send it way to early which is causing an invalid xml stream?
  • Can you attach the whole XML stream of your session?

Alex
Regis #3
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Dear Alex,

I'll work on extracting the full XML logs.
I'm off later on today until January.
I'll come back to you then.

Happy Holidays !

Régis
Regis #4
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
I checked and the request are made on time. It's actually working with ags.

Just for the sake of testing (since the xmpp server is quite old), is there any way I can force the "from" attribute to be populated in the request ?

Since AGS_XMPP was offering a Subscribe function capable of doing so...
This post was edited 2 times, last on 2020-12-24, 11:16 by Regis.
Avatar
Alex #5
Member since Feb 2003 · 4397 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The from attribute is always being populated by any XMPP compliant server, doesn't matter how old the server is.
This is how XMPP was designed from the very beginning for security reasons.

Otherwise the client would be able to spoof the from address. This is why the server always is responsible for stamping the packages with the correct from address.

Alex
Regis #6
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Quote by Alex:
The from attribute is always being populated by any XMPP compliant server, doesn't matter how old the server is.#+
This is how XMPP was designed from the very beginning for security reasons.

Otherwise the client would be able to spoof the from address. This is why the server always is responsible for stamping the packages with the correct from address.

Alex

Ok. I checked and the request is made on time. It's actually working with ags.
I'll keep digging. Must be something silly...
Regis #7
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I have created simple logs made by 1) Ags and 2) Matrix - as you can see the ags one subscribe successfully while the Matrix one gets a stream close with Invalid Xml. Any idea ?

AGS :
2021-01-06 17:06:27,917 [13] - OUT: <stream:stream to='appli-c14-rec2s03.xxx.fr' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
2021-01-06 17:06:27,963 [14] - IN: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="appli-c14-rec2s03.xxx.fr" id="3566472670027219305" xml:lang="en" version="1.0" >
2021-01-06 17:06:27,967 [15] - IN: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /></stream:features>
2021-01-06 17:06:27,968 [15] - OUT: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:27,992 [15] - IN: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:28,086 [15] - OUT: <stream:stream to='appli-c14-rec2s03.xxx.fr' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
2021-01-06 17:06:28,152 [14] - IN: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="appli-c14-rec2s03.xxx.fr" id="13352739286352206871" xml:lang="en" version="1.0" >
2021-01-06 17:06:28,153 [14] - IN: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>
2021-01-06 17:06:28,156 [14] - OUT: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">BASE64-DATA</auth>
2021-01-06 17:06:28,178 [15] - IN: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
2021-01-06 17:06:28,179 [15] - OUT: <stream:stream to='appli-c14-rec2s03.xxx.fr' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
2021-01-06 17:06:28,353 [14] - IN: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="appli-c14-rec2s03.xxx.fr" id="1121964640102966928" xml:lang="en" version="1.0" >
2021-01-06 17:06:28,354 [14] - IN: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional /></session><c xmlns="http://jabber.org/protocol/caps" node="http://www.process-one.net/en/ejabberd/" ver="AWHZnON5CNbQfVX8RbyCXC0iY4k=" hash="sha-1" /><sm xmlns="urn:xmpp:sm:2" /><sm xmlns="urn:xmpp:sm:3" /><csi xmlns="urn:xmpp:csi:0" /></stream:features>
2021-01-06 17:06:28,355 [14] - OUT: <iq id="agsXMPP_1" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>barometre</resource></bind></iq>
2021-01-06 17:06:28,377 [15] - IN: <iq xmlns="jabber:client" id="agsXMPP_1" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>gen1104n@appli-c14-rec2s03.xxx.fr/barometre</jid></bind></iq>
2021-01-06 17:06:28,532 [15] - OUT: <iq id="agsXMPP_2" type="set" to="appli-c14-rec2s03.xxx.fr"><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></iq>
2021-01-06 17:06:28,555 [14] - IN: <iq xmlns="jabber:client" to="gen1104n@appli-c14-rec2s03.xxx.fr/barometre" xml:lang="en" type="result" from="appli-c14-rec2s03.xxx.fr" id="agsXMPP_2" />
2021-01-06 17:06:28,558 [14] - OUT: <iq id="agsXMPP_3" type="set" to="pubsub.appli-c14-rec2s03.xxx.fr"><pubsub xmlns="http://jabber.org/protocol/pubsub"><subscribe node="gen1104n@appli-c14-rec2s03.xxx.fr/barometre" jid="/BAROMETRE/GEN1104N" /></pubsub></iq>
2021-01-06 17:06:28,559 [14] - OUT: <iq id="agsXMPP_4" type="get" to="appli-c14-rec2s03.xxx.fr"><query xmlns="jabber:iq:agents" /></iq>
2021-01-06 17:06:28,733 [14] - OUT: <iq id="agsXMPP_5" type="get"><query xmlns="jabber:iq:roster" /></iq>
2021-01-06 17:06:28,735 [14] - IN: <iq xmlns="jabber:client" to="gen1104n@appli-c14-rec2s03.xxx.fr/barometre" xml:lang="en" type="result" from="pubsub.appli-c14-rec2s03.xxx.fr" id="agsXMPP_3"><pubsub xmlns="http://jabber.org/protocol/pubsub"><subscription subscription="subscribed" jid="gen1104n@appli-c14-rec2s03.xxx.fr" subid="42" node="gen1104n@appli-c14-rec2s03.xxx.fr/barometre" /></pubsub></iq>
This post was edited 3 times, last on 2021-01-07, 07:08 by Regis.
Regis #8
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Matrix :

2021-01-06 17:06:56,711 [12] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:56,796 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="10751325119680311882" version="1.0" xml:lang="en" from="appli-c14-rec2s03.xxx.fr" xmlns="jabber:client" >
2021-01-06 17:06:56,800 [12] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
</stream:features>
2021-01-06 17:06:56,802 [12] - OUT:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:56,825 [15] - IN:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:56,937 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:56,960 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="7295615747783298081" version="1.0" xml:lang="en" from="appli-c14-rec2s03.xxx.fr" xmlns="jabber:client" >
2021-01-06 17:06:56,960 [13] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
</stream:features>
2021-01-06 17:06:56,965 [13] - OUT:<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">BASE64-DATA</auth>
2021-01-06 17:06:56,988 [15] - IN:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
2021-01-06 17:06:57,151 [15] - OUT:<iq id="MX_1" to="pubsub.appli-c14-rec2s03.xxx.fr" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s03.xxx.fr/planingStats" />
  </pubsub>
</iq>
2021-01-06 17:06:57,152 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:57,176 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="1878869575004603984" version="1.0" xml:lang="en" xmlns="jabber:client" >
2021-01-06 17:06:57,176 [13] - IN:<stream:error xmlns:stream="http://etherx.jabber.org/streams">
  <invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
</stream:error>
2021-01-06 17:06:57,177 [13] - OUT:</stream:stream>
2021-01-06 17:06:57,331 [13] - IN:</stream:stream>
2021-01-06 17:06:57,775 [13] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:57,797 [12] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="17658301850969662198" version="1.0" xml:lang="en" from="appli-c14-rec2s03.xxx.fr" xmlns="jabber:client" >
2021-01-06 17:06:57,798 [13] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
</stream:features>
2021-01-06 17:06:57,798 [13] - OUT:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:57,819 [13] - IN:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-06 17:06:57,874 [13] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:58,017 [12] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="8843972320121503676" version="1.0" xml:lang="en" from="appli-c14-rec2s03.xxx.fr" xmlns="jabber:client" >
2021-01-06 17:06:58,018 [12] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
</stream:features>
2021-01-06 17:06:58,018 [12] - OUT:<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">BASE64-DATA</auth>
2021-01-06 17:06:58,041 [12] - IN:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
2021-01-06 17:06:58,041 [12] - OUT:<iq id="MX_2" to="pubsub.appli-c14-rec2s03.xxx.fr" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s03.xxx.fr/planingStats" />
  </pubsub>
</iq>
2021-01-06 17:06:58,194 [12] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:58,217 [12] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="3674662246646877094" version="1.0" xml:lang="en" xmlns="jabber:client" >
2021-01-06 17:06:58,217 [12] - IN:<stream:error xmlns:stream="http://etherx.jabber.org/streams">
  <invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
</stream:error>
2021-01-06 17:06:58,220 [12] - OUT:</stream:stream>
2021-01-06 17:06:58,220 [12] - IN:</stream:stream>
This post was edited 3 times, last on 2021-01-07, 10:49 by Alex.
Avatar
Alex #9
Member since Feb 2003 · 4397 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In the MatriX logs I see no resource binding IQs. It looks like you are sending your packets to early and do not wait until the resource binding was established by Matrix. Which causes the server to kill your session then. Resource binding is required, otherwise the server cannot address you packets

Alex
Regis #10
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Alex,

The resource binding is not the issue here, I should have removed that part of the log. What you are talking about is in the AGS log which works.
I've edited the logs to avoid confusion.

AGS :
2021-01-06 17:06:28,735 [14] - IN: <iq xmlns="jabber:client" to="gen1104n@appli-c14-rec2s03.edf.fr/barometre" xml:lang="en" type="result" from="pubsub.appli-c14-rec2s03.edf.fr" id="agsXMPP_3"><pubsub xmlns="http://jabber.org/protocol/pubsub"><subscription subscription="subscribed" jid="gen1104n@appli-c14-rec2s03.edf.fr" subid="42" node="gen1104n@appli-c14-rec2s03.edf.fr/barometre" /></pubsub></iq>

I'm however not getting the subscription confirmation using Matrix. I don't know why ?

---- More context ----
I'm the IT lead for the GUI part of a large multi threaded software used daily by over 10,000 users. The Xmpp part of the software represents 5% of its functionalities (and is actually used for it's pubsub mechanism, not for chatting !) and is currently using agsXmpp. I'm looking to upgrade to Matrix.
The software takes anywhere between 3 to 5 mn to start so every test is a bit painful. It connects to 50 xmpp nodes on several xmpp connections. So obtaining clean logs using the software is not easy nor ideal, especially things its largely mutly threaded.
For this reason I've created a very simple application that connects to a single node of our xmpp server for testing purpose.
Using Matrix, I can't even make a simple subscription while as you can see from the logs I pasted, it works fine with ags.
I can't figure out why.
The Iq resource binding you saw is irrelevant to the problem. It's Matrix which gets disconnected without receiving even the subscription confirmation, not ags.

Hope that makes things a bit more clear.
This post was edited on 2021-01-07, 07:03 by Regis.
Regis #11
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Ok I did more tests and I can 100% confirm that :

<iq id="agsXMPP_3" type="set" to="pubsub.appli-c14-rec2s00.xxx.fr" from="gen1104n@appli-c14-rec2s03.edf.fr/barometre">
    <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s03.edf.fr/barometre" />
    </pubsub>
</iq>
   
-> agsXMPP WORKS (I get back the subscribed message)

<iq id="MX_1" to="gen1104n@appli-c14-rec2s00.xxx.fr/barometre" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s00.edf.fr/barometre" />
  </pubsub>
</iq>

->Matrix does not work with our server. The server returns Invalid XML then shuts the connection down.

The only difference I see is that ags is also sending a "from" tag which is now obsolete in Matrix. Maybe our server needs it. But I have no means of testing this theory.
Avatar
Alex #12
Member since Feb 2003 · 4397 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The server returns an error that the XML is invalid. I still think its a timing issue.
But I cannot confirm this when your Xml logs are incomplete or contain multiple user sessions in the log.

My findings explained here in this fragment of your log

2021-01-06 17:06:56,937 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:56,960 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="7295615747783298081" version="1.0" xml:lang="en" from="appli-c14-rec2s03.xxx.fr" xmlns="jabber:client" >
2021-01-06 17:06:56,960 [13] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
</stream:features>
2021-01-06 17:06:56,965 [13] - OUT:<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">BASE64-DATA</auth>
2021-01-06 17:06:56,988 [15] - IN:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />

After successful authentication the client and the server are resetting the Xml stream and need to restart the stream. While this is happening you seem to send already a Pubsub IQ which is too early in the session.

2021-01-06 17:06:57,151 [15] - OUT:<iq id="MX_1" to="pubsub.appli-c14-rec2s03.xxx.fr" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s03.xxx.fr/planingStats" />
  </pubsub>
</iq>

2021-01-06 17:06:57,152 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s03.xxx.fr" version="1.0" >
2021-01-06 17:06:57,176 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="1878869575004603984" version="1.0" xml:lang="en" xmlns="jabber:client" >
2021-01-06 17:06:57,176 [13] - IN:<stream:error xmlns:stream="http://etherx.jabber.org/streams">
  <invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
</stream:error>

The packet you send above is too early, the stream reset and resource binding did not happen yet. This packet is breaking the XMPP XML stream which is why the server is responding with invalid XML.

Alex
Regis #13
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
1) The logs is complete
2) There is only one user session
3) I've tried to send the subscribe 5 seconds after successful login and it still does not work.
4) Why is it working with agsXmpp ? I use exactly the same code, only the xmpp libraries change.

2021-01-07 14:33:38,837 [12] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s00.edf.fr" version="1.0" >
2021-01-07 14:33:38,891 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="9531101504593354832" version="1.0" xml:lang="en" from="appli-c14-rec2s00.xxx.fr" xmlns="jabber:client" >
2021-01-07 14:33:38,897 [15] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
</stream:features>
2021-01-07 14:33:38,899 [15] - OUT:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-07 14:33:38,922 [15] - IN:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2021-01-07 14:33:39,020 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s00.edf.fr" version="1.0" >
2021-01-07 14:33:39,087 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="8512634240039538297" version="1.0" xml:lang="en" from="appli-c14-rec2s00.xxx.fr" xmlns="jabber:client" >
2021-01-07 14:33:39,087 [13] - IN:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>X-OAUTH2</mechanism>
  </mechanisms>
</stream:features>
2021-01-07 14:33:39,101 [13] - OUT:<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">BASE64-DATA</auth>
2021-01-07 [b]14:33:39[/b],286 [15] - IN:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
2021-01-07 [b]14:33:44,295[/b] [15] - OUT:<iq id="MX_1" to="gen1104n@appli-c14-rec2s00.xxx.fr/barometre" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <subscribe node="/BAROMETRE/GEN1104N" jid="gen1104n@appli-c14-rec2s00.edf.fr/barometre" />
  </pubsub>
</iq>
2021-01-07 14:33:47,094 [15] - OUT:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="appli-c14-rec2s00.edf.fr" version="1.0" >
2021-01-07 14:33:47,094 [13] - IN:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="6431299757403474880" version="1.0" xml:lang="en" xmlns="jabber:client" >
2021-01-07 14:33:47,095 [13] - IN:<stream:error xmlns:stream="http://etherx.jabber.org/streams">
  <invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
</stream:error>
2021-01-07 14:33:47,096 [13] - OUT:</stream:stream>
2021-01-07 14:33:47,096 [15] - IN:</stream:stream>

  1. public void Connect()
  2. {
  3.     _xmppCon = CreateConnection();
  4.     _xmppCon.Open();
  5. }
  6.  
  7. private XmppClient CreateConnection()
  8. {
  9.  
  10.     var xmppCon = new XmppClient()
  11.     {
  12.         //SocketConnectionType = agsXMPP.Net.SocketConnectionType.Direct,
  13.         //Server = xmppServer.Host,
  14.         XmppDomain = "appli-c14-rec2s00.xxx.fr",
  15.         Port = 11409,
  16.         Resource = "barometre",
  17.         Username = "gen1104n",
  18.         Password = "somePass",
  19.         //UseSSL = false,
  20.         //AutoResolveConnectServer = false,
  21.         //UseCompression = false
  22.     };
  23.  
  24.     _mainJid = new Jid(xmppCon.Username, xmppCon.XmppDomain, xmppCon.Resource);
  25.     _pubsubUrl = new Jid("pubsub." + xmppCon.XmppDomain);
  26.     xmppCon.OnLogin += XmppConOnLogin;
  27.     xmppCon.OnError += XmppConOnError;
  28.     xmppCon.OnClose += XmppConOnOnClose;
  29.     xmppCon.OnStreamError += XmppConOnOnStreamError;
  30.     xmppCon.OnReceiveXml += XmppConOnOnReceiveXml;
  31.     xmppCon.OnSendXml += XmppConOnOnSendXml;
  32.     xmppCon.OnMessage += XmppConOnOnMessage;
  33.     return xmppCon;
  34. }
  35.  
  36. private void XmppConOnLogin(object sender, EventArgs eventArgs)
  37. {
  38.     var psm = new PubSubManager(_xmppCon);
  39.    
  40.     Thread.Sleep(5000);
  41.     psm.Subscribe(_mainJid, "/BAROMETRE/GEN1104N", _mainJid);
  42. }
This post was edited on 2021-01-07, 13:52 by Alex.
Avatar
Alex #14
Member since Feb 2003 · 4397 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Regis:
3) I've tried to send the subscribe 5 seconds after successful login and it still does not work.

using a timer is not correct. You need to wait at least until MatriX triggers the OnBind event to you. Or until you receive the first incoming <Presence/> stanza.

OnLogin is not the correct event for this. This event means only that you are authenticated, but the session is not ready for data yet.
Use the OnBind event instead
Regis #15
Member since Dec 2020 · 10 posts
Group memberships: Members
Show profile · Link to this post
Houston, we have liftoff
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:
Page:  1  2  next
Forum: MatriX RSS