build/heimdallr-client.js
/**
 * The Client constructor performs some initialization including setting up a
 * default error listener.
 *
 * @class
 * @classdesc Base class for Heimdallr clients.
 * @private
 * @arg {string} token - Authentication token, provider or consumer.
 * @arg {object} [options] - socket.io options passed to io.Manager.
 * @return {module:heimdallrClient~Client} A new Heimdallr Client object.
 */
The Client constructor performs some initialization including setting up a
default error listener.

@class
@classdesc Base class for Heimdallr clients.
@private
@arg {string} token - Authentication token, provider or consumer.
The Client constructor performs some initialization including setting up a default error listener . @class @classdesc Base class for Heimdallr clients . @private @arg { string } token - Authentication token provider or consumer .
function Client(token, options) {
    var manager,
        self = this;
    options = options || {};
    options.autoConnect = false;
    manager = new io.Manager(self.url, options);
    self.ready = false;
    self.readyCallbacks = [];
    self.token = token;
    self.connection = manager.socket(parseURL(self.url).pathname);
    self.connection.on('err', function (err) {
        if (err instanceof Error) {
            throw err;
        }
        if (err instanceof Object && err.hasOwnProperty('message')) {
            throw new Error(err.message);
        }
        throw new Error(err);
    });
    self.connection.on('auth-success', function () {
        self.readyCallbacks.map(function (fn) {
            fn();
        });
        self.readyCallbacks = [];
        self.ready = true;
    });
    self.connection.on('connect', function () {
        self.connection.emit(
            'authorize',
            {token: self.token, authSource: self.authSource}
        );
    });
}
function Client ( token , options ) { var manager , self = this ; options = options || { } ; options . autoConnect = false ; manager = new io . Manager ( self . url , options ) ; self . ready = false ; self . readyCallbacks = [ ] ; self . token = token ; self . connection = manager . socket ( parseURL ( self . url ) . pathname ) ; self . connection . on ( 'err' , function ( err ) { if ( err instanceof Error ) { throw err ; } if ( err instanceof Object && err . hasOwnProperty ( 'message' ) ) { throw new Error ( err . message ) ; } throw new Error ( err ) ; } ) ; self . connection . on ( 'auth-success' , function ( ) { self . readyCallbacks . map ( function ( fn ) { fn ( ) ; } ) ; self . readyCallbacks = [ ] ; self . ready = true ; } ) ; self . connection . on ( 'connect' , function ( ) { self . connection . emit ( 'authorize' , { token : self . token , authSource : self . authSource } ) ; } ) ; }
The Client constructor performs some initialization including setting up a
 default error listener.
The Client constructor performs some initialization including setting up a default error listener .
// The autoConnect = false allows us to create a socket object that // doesn't try to immediately connect to the server. // Unfortunately we haven't come up with a good standard format for // errors on the server side and so for the time being they are coming // across in a variety of forms.