index.js 610 Bytes
var xmpp = require('simple-xmpp');

xmpp.on('online', function(data) {
    console.log('Online');
    console.log(data);
    console.log('Connected with JID: ' + data.jid.user);
    console.log('Yes, I\'m connected!');
});

xmpp.on('chat', function(from, message) {
    xmpp.send(from, 'echo: ' + message);
});

xmpp.on('error', function(err) {
    console.error(err);
});

xmpp.on('subscribe', function(from) {
    xmpp.acceptSubscription(from);
});

xmpp.connect({
        jid: config.globals.jid,
        password: config.globals.password,
});

// check for incoming subscription requests
xmpp.getRoster();