I am running a local ejabberd 2 server and I have 2 users. jeremy@pbx.dev and billy@pbx.dev. Both users have each other on their rosters added from the ejabberd admin webportal.
I'm using adium on OSX logged in with the jeremy account. I would like to use the node console and see the billy account show as online allowing me to message billy from adium, and message jeremy from the node REPL.
var Client = require('node-xmpp-client'),
ltx = require('node-xmpp-core').ltx;
var client = new Client({jid: 'billy@pbx.dev', password: 'password'});
client.on('online', function(data) {
console.log('Connected as ' + data.jid.user + '@' + data.jid.domain + '/' + data.jid.resource)
var presence = new ltx.Element('presence', { type: 'available' }).c('show').t('chat');
client.send(presence);
});
client.on('stanza', function(stanza) {
console.log('RECEIVED STANZA', stanza);
});
client.on('offline', function () {
console.log('Client is offline');
});
client.on('connect', function () {
console.log('Client is connected');
});
// log in
client.connect();
var message = new ltx.Element('message',{to: 'jeremy@pbx.dev', type: 'chat'}).c('body').t('sup?');
// send message
client.send(message);
var roster = new ltx.Element('iq',{id: 'roster_0',type: 'get'}).c('query', { xmlns: 'jabber:iq:roster'});
// get roster
client.send(roster);
// log out
client.end();
I can send messages from the billy account to the jeremy account, and vice versa just fine. However, I can't see that billy is online from Adium though.
To double test this, I created a third user called "asterisk". I added "asterisk" to the jeremy roster, and then set this user up through Asterisk. I can see this user online through Adium.
Any thoughts on what I might be missing?