2
votes

I am using Openfire 3.10.2 XMPP server and Strophe library as client. I want to send messages via push notification to all the users in the chat room who did not join the chat room.

How to get Openfire user presence in the chat room

Is there any plugin for it ?

Are the user presence in the chat room saved in database ? How can I achieve this ?

1

1 Answers

2
votes

You said you would send messages to users IN the chat room who did NOT JOIN the chat room: it seems a contraddiction. If a user doesn't join a room he isn't IN the room and so there's no way to send messages exchanged in the room also to this user.

Regarding room presence you don't need a plugin, but you can relay on a presence handler attached to Strophe.connection. Here is an example:

connection.addHandler(onPresence, null, "presence");

...

function onPresence(presence) {
    var msg = $(presence);
    if (msg.children('x[xmlns^="' + Strophe.NS.MUC + '"]').length > 0) {
        // muc presence
        onRoomPresence(presence);
    } else {
        // user presence
        onUserPresence(presence);
    }
    return true;
}

However, there is also a Strophe plugin named MUC (see strophe.muc.js)