AnsweredAssumed Answered

XMPP Stream difference between smack 4.1.0 and 4.0.3

Question asked by Jesse on Mar 16, 2015
Latest reply on Mar 16, 2015 by Flow

Hello,

 

I'm trying to update my smack client from 4.0.3 to 4.1.0, however I'm seeing some difference in the XMPP stream when trying to re-authenticate (i.e. login again without disconnecting the subscriber):

 

The older version of smack has this stream (I've bolded the difference with the new stream):

 

  • Accepted connection server:port -> xmpp_server:5222
  • Received XML on stream = <<"<stream:stream to=\"server\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='fake_id' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>">>
  • Received XML on stream = <<"<stream:stream to=\"server\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1432685044' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"</stream:stream>">>
  • Send XML on stream = <<"</stream:stream>">>
  • Accepted connection server:port -> xmpp_server:5222
  • Received XML on stream = <<"<stream:stream to=\"server\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='fake_id' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>">>
  • Received XML on stream = <<"<stream:stream to=\"server\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3939343755' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<auth mechanism=\"PLAIN\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">MjM0NTU1MzAxMgAyMzQ1NTUzMDEyADcyODQ= </auth>">>
  • Send XML on stream = <<"<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>">>
  • Received XML on stream = <<"<stream:stream to=\"server\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='fake_id' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Closing former stream of resumed session for number2@server/resource2
  • Send XML on stream = <<"<resumed xmlns='urn:xmpp:sm:2' h='1' previd='g2gEbQAAAAoyMzQ1NTUzMDEybQAAABthYnUtZGV2LXhtcHAubWV0YXN3aXRjaC5jb21tAAA AGkFjY01vYkFuZC0yNzhlMjQ3ZjkzOWY1YjUzaANiAAAFkWIAAJkjYgANSs8='/>">>
  • Send XML on stream = <<"<r xmlns='urn:xmpp:sm:2'/>">>
  • Resumed session for number2@server/resource2
  • Received XML on stream = <<"<a xmlns=\"urn:xmpp:sm:2\" h=\"1\"/>">>

 

 

 

New stream using smack 4.1.0:

 

  • Received XML on stream = <<"<stream:stream xmlns='jabber:client' to='server' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='number1@server' xml:lang='en'>">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='2395068889' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>">>
  • Received XML on stream = <<"<stream:stream xmlns='jabber:client' to='server' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='number1@server' xml:lang='en'>">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3615464713' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanis ms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADIzNDU1NTUwMDAAc2Vzc2lvbi5hY2Nlc3Npb24ubWV0YXN3aXRjaC5jb209M jg3MDJiMzZjZGZkYmI5Zg==</auth>">>
  • Send XML on stream = <<"<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>">>
  • Received XML on stream = <<"<stream:stream xmlns='jabber:client' to='server' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='number1@server' id='3615464713' xml:lang='en'>">>
  • Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1353794583' from='server' version='1.0' xml:lang='en'>">>
  • Send XML on stream = <<"<stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='6VZ6iIYYbDan8K64FBjOKQ1hxbc='/></stream:features>">>
  • Received XML on stream = <<"<iq id='qDc2t-11' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>Smack</resource></bind></iq> ">>
  • Send XML on stream = <<"<iq id='qDc2t-11' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>number1@server/Smack</jid></bind></iq>">>
  • Received XML on stream = <<"<iq id='qDc2t-13' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>">>
  • Send XML on stream = <<"<iq type='result' id='qDc2t-13'/>">>
  • Send XML on stream = <<"<stream:error><conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'></conflict><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Replaced by new connection</text></stream:error>">>
  • Send XML on stream = <<"</stream:stream>">>
  • Received XML on stream = <<"<enable xmlns='urn:xmpp:sm:3' resume='true'/>">>
  • Send XML on stream = <<"<enabled xmlns='urn:xmpp:sm:3' id='g2gEbQAAAAoyMzQ1NTU1MDAwbQAAABthYnUtZGV2LXhtcHAubWV0YXN3aXRjaC5jb21tAAAABVN tYWNraANiAAAFkWIACMnFYgAAyuc=' resume='true' max='300'/>">>
  • Received XML on stream = <<"<iq id='qDc2t-15' type='get'><query xmlns='jabber:iq:roster'></query></iq><presence id='qDc2t-16'></presence>">>
  • Send XML on stream = [<<"<iq from='number1@server' to='number@server/Smack' id='qDc2t-15' type='result'><query xmlns='jabber:iq:roster'/></iq>">>,<<"<r xmlns='urn:xmpp:sm:3'/>">>]
  • Send XML on stream = [<<"<presence from='number1@server/Smack' to='number1@server/Smack' xml:lang='en' id='qDc2t-16'/>">>,<<"<r xmlns='urn:xmpp:sm:3'/>">>]
  • Received XML on stream = <<"<presence id='qDc2t-17'></presence>">>
  • Send XML on stream = [<<"<presence from='number1@server/Smack' to='number1@server/Smack' xml:lang='en' id='qDc2t-17'/>">>,<<"<r xmlns='urn:xmpp:sm:3'/>">>]
  • Received XML on stream = <<"<a xmlns='urn:xmpp:sm:3' h='1'/><a xmlns='urn:xmpp:sm:3' h='2'/>">>
  • Received XML on stream = <<"<a xmlns='urn:xmpp:sm:3' h='3'/>">>

 

 

Does anyone know why I'm getting this difference? Are there any parameters I can set so that I get the same flow as before when re-authenticating the subscriber? Any help you can provide will be greatly appreciated.

Outcomes