lib/rocket-chat.js
function (protocol, host, port, username, password, onConnected) {
    this.rocketChatClient = new RocketChatClient(protocol, host, port, username, password, onConnected);
    this.token = null;

    /**
     * login the rocket chat
     * @param callback after login the rocket chat , will invoke the callback function
     */
    this.login = function (username, password, callback) {
        var self = this;
        this.rocketChatClient.authentication.login(username, password, function (err, body) {
            
            self.token = body.data;
            callback(null, body);
        });
    };
}
function (protocol, host, port, username, password, onConnected) {
    this.rocketChatClient = new RocketChatClient(protocol, host, port, username, password, onConnected);
    this.token = null;

    /**
     * login the rocket chat
     * @param callback after login the rocket chat , will invoke the callback function
     */
    this.login = function (username, password, callback) {
        var self = this;
        this.rocketChatClient.authentication.login(username, password, function (err, body) {
            
            self.token = body.data;
            callback(null, body);
        });
    };
}
function ( protocol , host , port , username , password , onConnected ) { this . rocketChatClient = new RocketChatClient ( protocol , host , port , username , password , onConnected ) ; this . token = null ; /**
     * login the rocket chat
     * @param callback after login the rocket chat , will invoke the callback function
     */ this . login = function ( username , password , callback ) { var self = this ; this . rocketChatClient . authentication . login ( username , password , function ( err , body ) { self . token = body . data ; callback ( null , body ) ; } ) ; } ; }
Rocket Chat Api constructor
@param protocol rocket chat protocol
@param host rocket chat host , default is https://demo.rocket.chat
@param port rocket chat port , default is 80
@param username rocket chat username
@param password rocket chat password
@param onConnected callback that is invoked when connection is open
@constructor
Rocket Chat Api constructor