Socketio.connectClientSocket()

Connect a Socket.io client to a Sails.js server.

Usage

Hover over inputs/exits for more info.

var Socketio = require('machinepack-sockets');


// Connect a Socket.io client to a Sails.js server.

Socketio.connectClientSocket({

baseUrl: 'http://localhost:1337',

eventListeners: [ { name: 'foobar', fn: '->' } ],

timeout: 5000,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The socket took too long to connect.

tookTooLong: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

baseUrl required

The base URL for the Sails.js server.

'http://localhost:1337'
eventListeners

A mapping of event listeners for client socket events.

[ { name: 'foobar', fn: '->' } ]
timeout

The max time to wait before giving up on initial connection (in miliseconds).

5000

Exits

error

An unexpected error occurred.

tookTooLong

The socket took too long to connect.

success

OK.

'==='