njabbr

Jabbr client for Node.js

npm install njabbr
1 downloads in the last week
51 downloads in the last month

njabbr

A nodejs Jabbr client

Install

npm install njabbr

Usage

var JabbrClient = require('njabbr').JabbrClient;

var client = new JabbrClient("http://jabbr-staging.apphb.com/");

client.on('messageReceived', function(msg, room) {
    console.log("[" + msg.When + "] " + msg.User.Name + ": " + msg.Content);
});

client.connect("username", "password", function(task) {
    console.log("You are now logged in");

    client.joinRoom("SomeTestRoom", function() {

        console.log("You have joined SomeTestRoom");        

        // speak robot speak!
        client.say("Hey everyone!", "SomeTestRoom");

        client.getRoomInfo("SomeTestRoom", function(roomInfo) {
            console.log("Users");
            for (var key in roomInfo.Users) {
                var user = roomInfo.Users[key];
                console.log(user.Name);
            }
        });

    });

    // logoff after 10 seconds
    setTimeout(function() {
        client.disconnect();
    }, 10000);

});
npm loves you