How to close the XMPP connection without sending presence

If I close the XMPPConnection, the documentation says that it will send an unavailable presence state. How could I close the connection without sending any presence state properly?

Hey Markus,

Could you explain a little more the reason for this request? Note that XMPP expects clients to send an unavailable presence when ending the session (i.e. the connection) and if a client does not send it then the server will broadcast an unavailable presence for the client. That means that even if you don’'t send an unavailable presence then the server will do that for you.

Regards,

– Gato

Hi Gato

If there are mutliple applications for the same user connected, I don’‘t want the server to send an unavailable when my application opens or closes. With other words, I want to create an application which does just listen for a user but doesn’‘t change any states. Isn’'t this possible?

Cheers

Markus

Hey Markus,

I don’‘t think that it is possible to do what you are trying to achieve. XMPP states that for each connection that sent an available presence, an unavailable presence should be sent when the connection is closed. And if the client didn’'t send the unavailable presence then the server will send it on behalf of the client.

However, you might implement your requirement by creating your own set of packet extensions. You would need to create a protocol (set of packets to sent and received based on certain rules) that can fulfil your requirements.

Regards,

– Gato