powered by Jive Software

How to get all resources a user is logged in from?

Hello friends,

How can I find all the resources a user is logged in from ? (I could not find table in the openfire schema which stores this info)

I need this information to send a message to all resources of the target user. (Like in Gtalk). I cannot depend on roster iqs (as suggested in one of the related questions), as I have to support adhoc messages between strangers too.

I believe it should be somewhere there in the database. Please help !




The need is to sent an outgoing message to other active resources of the user.



I don’t think there is any way to find out all the resources except looking at the 'Sessions" tab in Admin Console. But you can try setting “route.all-resources” property to true in openfire System Properties.

By default, openfire routes the message to the highest priority or recently used resource, but you can override that behavior with route.all-resources.

That will still only route to all resources with the same highest priority. Another thing to note is that the message has to be addressed to the bare JID not the full JID. Messages addressed to the full JID are required to only be delivered to that JID.

If your use case is to broadcast to all the sessions of a particular user, I would suggest you many want to customize the broadcast plugin to do it. It provides the functionality to broadcast a message to all users, or a specific group, but I don’t think it would take much work to make it broadcast to all sessions for a specific bare JID.