Project

General

Profile

Bosh disconnection => send Offline presence ?

# JeSuisTigase
Added about 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 about 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'
      sid='SomeSID'
      type='terminate'
      xmlns='http://jabber.org/protocol/httpbind'>
  <presence type='unavailable'
            xmlns='jabber:client'/>
</body>

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 about 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(ArrayList.java:635)

    at java.util.ArrayList.get(ArrayList.java:411)

    at tigase.server.AbstractMessageReceiver.addPacketNB(AbstractMessageReceiver.java:360)

    at com.dassault_systemes.tigase.CASAuth.updateOnlineStatus(CASAuth.java:601)

    at com.dassault_systemes.tigase.CASAuth.logout(CASAuth.java:272)

? is that error the same as this one : https://projects.tigase.org/boards/4/topics/2033 ?

(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 about 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 : https://projects.tigase.org/boards/4/topics/2033 ?

This issue is not related to https://projects.tigase.org/boards/4/topics/2033

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.

    (1-3/3)