Question

I successfully connected to openfire server using strophe librabry.

I want a javascript function that returns all users from a conference room.

An another question is: how can i set/get current user's status?

My current code:

$(document).ready(function() {
    connection = new Strophe.Connection(BOSH_SERVICE);
    connection.connect("null",
            "null",
            onConnect);
});

function onConnect(status)
{
    if (status == Strophe.Status.CONNECTED) {
        $('#notifications').html('<p class="welcome">Hello! Any new posts will appear below.</p>');
        connection.addHandler(notifyUser, null, 'message', null, null, null);
        console.log('send ');
        var pres = $pres({to: 'chat@conference.neo-pc/catalin'});
        connection.send(pres);


    }
}
Was it helpful?

Solution

after you send initial presence, you will get a roster.

http://xmpp.org/rfcs/rfc6121.html#roster-login - how to retrieve roster after login.

to get somebody's presence, you need to send a presence IQ. then get the status element.

if you want to have a look at my xmppp client that i've built using strophe.js, please go to: http://hularing.me/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top