lib/utils/socket_client.js
function socketClient(serviceUrl) {
  var self = object.create(socketClient.prototype);
  var urlObject = url.parse(serviceUrl);

  // create the url without the path
  var socketIoUrl = url.format({
    protocol: urlObject.protocol,
    hostname: urlObject.hostname
  });

  var options = {
    reconnection: true,
    reconnectionDelay: 1000,
    reconnectionDelayMax: 50000,
    reconnectionAttempts: 5,
    autoConnect: false,
    path: url.clearTraliningSlash(urlObject.path) + '/socket.io/'
  };

  self.socket = io(socketIoUrl, options);
  self.opened = false;

  return self;
}
function socketClient(serviceUrl) {
  var self = object.create(socketClient.prototype);
  var urlObject = url.parse(serviceUrl);

  // create the url without the path
  var socketIoUrl = url.format({
    protocol: urlObject.protocol,
    hostname: urlObject.hostname
  });

  var options = {
    reconnection: true,
    reconnectionDelay: 1000,
    reconnectionDelayMax: 50000,
    reconnectionAttempts: 5,
    autoConnect: false,
    path: url.clearTraliningSlash(urlObject.path) + '/socket.io/'
  };

  self.socket = io(socketIoUrl, options);
  self.opened = false;

  return self;
}
function socketClient ( serviceUrl ) { var self = object . create ( socketClient . prototype ) ; var urlObject = url . parse ( serviceUrl ) ; // create the url without the path var socketIoUrl = url . format ( { protocol : urlObject . protocol , hostname : urlObject . hostname } ) ; var options = { reconnection : true , reconnectionDelay : 1000 , reconnectionDelayMax : 50000 , reconnectionAttempts : 5 , autoConnect : false , path : url . clearTraliningSlash ( urlObject . path ) + '/socket.io/' } ; self . socket = io ( socketIoUrl , options ) ; self . opened = false ; return self ; }
Construct a socket io client based on a serviceUrl
@param {string} serviceUrl
@return {socketClient}
Construct a socket io client based on a serviceUrl