Bosh disconnection => send Offline presence ?

# JeSuisTigase
Added over 3 years ago

Hello !

i'm facing a new problem : I have an Instant MEssaging client on a website (a "platform"), when the user logout from this platform, the client shut down the bosh connection, then the server logs these lines :

[logs showing session closing and bosh disconnection]

But, the contacts of this user still see him online !

Is there a way to send an Offline presence when someone is logging out ?

Replies (3)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 3 years ago

It is hard to tell that is exactly sent or being received from this log but I assume that this is just disconnection.

By default XMPP-BOSH client on disconnection should properly disconnect send ie.

<body rid='1249243565'
  <presence type='unavailable'

as specified in XEP-0124.

On close of last BOSH connection, BOSH connection manager start timer for 10 seconds or for max inactivity time and if there will be no new BOSH connection from this client XMPP session will be closed which would result in sending presence offline.

If you need to know that user is disconnected faster I would suggest to use WebSocket connection as it will allow on faster detection of user disconnection.

Added by # JeSuisTigase over 3 years ago

Thank you for your answer Andrzej,

We managed this problem by creating a component which receives a stanza at disconnection.

My new problem now is that I can not send the packet out of the component (in order to broadcast the presence).

The component extends AbstractMessageReceiver and I want to make use of addOutPacket or addPacketNB.

For this, I overrided hashCodeForPacket as we can read in tigase doc (if I don't add this method to my component, I get a "java null pointer exception" on this function).

Thus, addPacketNB (or other addpacket method) creates this stack trace :

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

    at java.util.ArrayList.rangeCheck(

    at java.util.ArrayList.get(

    at tigase.server.AbstractMessageReceiver.addPacketNB(

    at com.dassault_systemes.tigase.CASAuth.updateOnlineStatus(

    at com.dassault_systemes.tigase.CASAuth.logout(

? is that error the same as this one : ?

(we use tigase server 5.1-beta8)

? Do you have a better idea to broadcast a presence inside a component ?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 3 years ago

I would suggest you to check if method start() of AbstractMessageReceiver is executed - it should be called by Tigase XMPP Server when component is loaded and started and is responsible for creation of processing threads. However in your case processing threads list is empty which suggests that it was not called. Did you override start() method or overrided startThreads() method of component?

is that error the same as this one : ?

This issue is not related to

Do you have a better idea to broadcast a presence inside a component ?

I do not have any other idea, but I do not really understand what are you trying to do.