disconnect all sessions for a given JID
Submitted by Anonymous on Wed, 2010-01-27 10:55
Hi
we added some "push services" to Tigase to we can push given actions from php to one of our Tigase servers.
For example, when a user clicks logout in the website, all bosh sessions (multiple browser tabs,...) should be closed and all roster buddies should receive the unavailable presence.
Is there an easy way to close all sessions for a given JID, so it's completely logged out?
I know there will be some hacking needed, that's no problem ;-) I just need to know where I can implement this.
thanks!
Cliff
- 506 reads
Printer-friendly version- Send to friend






probably our mistake ;-)
probably our mistake ;-)
I succeeded with implementing
I succeeded with implementing this piece of code, but I notice during some tests that my buddies don't receive a unavailable presence. (all my bosh connections do get interrupted => great success ;-))
After some time, the connection seems to time out and then I go offline.
Does "conn.logout();" also send the unavailable presence to all my buddies?
Thanks!
yes, coding it is ;-) thanks
yes, coding it is ;-)
thanks for the tip!
we have a way for detecting web client connections (the resource is always starting with a given prefix), so it's possible to leave connections from desktop clients open (though no one is using desktop clients because nobody knows it is possible ;-))
If by "hacking" you mean
If by "hacking" you mean coding then yes, if you mean workaround or dirty hacks then no ;-).
What I would do to solve the problem is.
The first scenario, assumes that the "logout-all" command is sent from one of the user's connection:
for (XMPPResourceConnection conn : session.getActiveSessions()) { conn.logout(); }Another scenario assumes that the logout-all command is sent from the administrator account. One of the command parameter is the user-id. In such a case you can implement it using scripting framework and your application just needs to send an ad-hoc command to the server.
Please note, this is quite easy to close all user connection using any of the above approaches. However this might not be always desired. Let's say the user connects to the Tigase from the website via Bosh and also he connects from the standalone client via standard XMPP connection. There is no easy way to distinguish user connections (it is possible though) and disconnect only Bosh connections.
Post new comment