Why server closes the stream suddenly

Hi we are currently developing our own API to communicate with Jabber servers like wildfire/openfire everything i.e opening Stream,authentication,login etc is going fine.

What we do

  • Using our API we come online (on wildfire) using a user say A.
  • Another user B (B has A in it’'s roster List) is already online on SPARK.
  • B can see A coming online.

All is going well but I am experiencing a strange behavior from wildfire server that it suddenly closes the Stream and logout A.

At client side I get the </stream:stream> tag , can’'t figure it out that why I am getting this problem.

Can you please guide me that what are the situations when wildfire has to close a stream forcefully.

below is the xml stenzas between server and client for the whole login process.

DEBUG:26 Jun 2007 05:47:25,>> WRITE: <?xml version=’‘1.0’’?><stream:stream to=’‘tcmjabberserver.com’’ xmlns=’‘jabber:client’’ xmlns:stream=’‘http://etherx.jabber.org/streams’’ version=’‘1.0’’>

DEBUG:26 Jun 2007 05:47:26,<< Read: <stream:features ><starttls xmlns=urn:ietf:params:xml:ns:xmpp-tls/><mechanisms xmlns=urn:ietf:params:xml:ns:xmpp-sasl ><mechanism >PLAIN</mechanism><mechanism >CRAM-MD5</mechanism><mechanism >DIGEST-MD5</mechanism><mechanism >ANONYMOUS</mechanism></mechanisms><compression xmlns=http://jabber.org/features/compress ><method >zlib</method></compression><auth xmlns=http://jabber.org/features/iq-auth/></stream:features>

DEBUG:26 Jun 2007 05:47:26,stream:features received

DEBUG:26 Jun 2007 05:47:27,>> WRITE: <iq type=’‘get’’ to=’‘tcmjabberserver.com’’ id=’‘authp4’’><query xmlns=’‘jabber:iq:auth’’><username>sajjad2</username></query& gt;</iq>

DEBUG:26 Jun 2007 05:47:27,<< Read: <iq type=result from=tcmjabberserver.com id=authp4 ><query xmlns=jabber:iq:auth ><username >sajjad2</username><password/><digest/><resource/>&l t;/query></iq>

DEBUG:26 Jun 2007 05:47:27,>> WRITE: <auth mechanism=“PLAIN” xmlns=“urn:ietf:params:xml:ns:xmpp-sasl”>c2FqamFkMkB0Y21qYWJiZXJzZXJ2ZXIuY29 tAHNhamphZDIAdGNt</auth>

DEBUG:26 Jun 2007 05:47:28,<< Read: <success xmlns=urn:ietf:params:xml:ns:xmpp-sasl/>

DEBUG:26 Jun 2007 05:47:28,>>>>>> Jabber login is successfull

DEBUG:26 Jun 2007 05:47:28,>> WRITE: <?xml version=’‘1.0’’?><stream:stream to=’‘tcmjabberserver.com’’ xmlns=’‘jabber:client’’ xmlns:stream=’‘http://etherx.jabber.org/streams’’ version=’‘1.0’’>

DEBUG:26 Jun 2007 05:47:29,<< Read: <stream:features ><compression xmlns=http://jabber.org/features/compress ><method >zlib</method></compression><bind xmlns=urn:ietf:params:xml:ns:xmpp-bind/><session xmlns=urn:ietf:params:xml:ns:xmpp-session/></stream:features>

DEBUG:26 Jun 2007 05:47:29,stream:features received

DEBUG:26 Jun 2007 05:47:29,>> WRITE: <iq type=’‘set’’ id=’‘5’’><bind xmlns=’‘urn:ietf:params:xml:ns:xmpp-bind’’><resource>mobilesajjad2< /resource></bind></iq>

DEBUG:26 Jun 2007 05:47:30,<< Read: <iq type=result to=tcmjabberserver.com/ab36624c id=5 ><bind xmlns=urn:ietf:params:xml:ns:xmpp-bind ><jid >sajjad2@tcmjabberserver.com/mobilesajjad2</jid></bind></iq>

DEBUG:26 Jun 2007 05:47:30,>> WRITE: <iq type=’‘get’’><query xmlns=’‘jabber:iq:roster’’/></iq>

DEBUG:26 Jun 2007 05:47:30,>> WRITE: <presence from=’‘sajjad2@tcmjabberserver.com/mobilesajjad2’’><status>Away</status></presence>

DEBUG:26 Jun 2007 05:47:31,<< Read: <iq type=result to=sajjad2@tcmjabberserver.com/mobilesajjad2 ><query xmlns=jabber:iq:roster ><item jid=sajjad1@tcmjabberserver.com subscription=both/><item jid=sajjad2@tcmjabberserver.com subscription=both/><item jid=sajjad3@tcmjabberserver.com subscription=both/></query></iq>

DEBUG:26 Jun 2007 05:47:31,<< Read: <presence to=sajjad2@tcmjabberserver.com/mobilesajjad2 from=sajjad2@tcmjabberserver.com/mobilesajjad2 ><status >Away</status></presence>

JabberRosterItem>>>>sajjad1@tcmjabberserver.com

JabberRosterItem>>>>sajjad2@tcmjabberserver.com

JabberRosterItem>>>>sajjad3@tcmjabberserver.com

DEBUG:26 Jun 2007 05:47:31,Presence Received from sajjad2@tcmjabberserver.com/mobilesajjad2

DEBUG:26 Jun 2007 05:47:31,His Status is

Hey sajjad.paracha,

Is your client sending heartbeats to the server? By default the server will close idle connections after 6 minutes of no traffic. So you can either change your client to send heartbeats (e.g. a white space char) every minute of no traffic or just change the system property xmpp.client.idle to a higher value than 360000 (6 minutes = 6 * 60 * 1000).

Regards,

– Gato