Merge pull request #2 from PeterTheOne/patch-1
fixed initialization of websocket
This commit is contained in:
commit
f4d30aa024
16
lib/node.js
16
lib/node.js
|
@ -38,11 +38,6 @@ var CONNECTION_ATTEMPTS_TIMEOUT = 1000;
|
|||
Socket = Primus.createSocket({
|
||||
transformer: 'websockets',
|
||||
pathname: '/api',
|
||||
timeout: 120000,
|
||||
strategy: 'disconnect,online,timeout',
|
||||
reconnect: {
|
||||
retries: 30
|
||||
},
|
||||
plugin: {emitter: Emitter, sparkLatency: Latency}
|
||||
});
|
||||
|
||||
|
@ -210,9 +205,14 @@ Node.prototype.startSocketConnection = function()
|
|||
if( !this._socket )
|
||||
{
|
||||
console.info('wsc', 'Starting socket connection');
|
||||
|
||||
socket = new Socket( process.env.WS_SERVER || 'ws://localhost:3000' );
|
||||
|
||||
socket = new Socket( process.env.WS_SERVER || 'ws://localhost:3000', {
|
||||
timeout: 120000,
|
||||
strategy: 'disconnect,online,timeout',
|
||||
reconnect: {
|
||||
retries: Infinity,
|
||||
max: 300000 // retry at least every 5 minutes
|
||||
}
|
||||
});
|
||||
this.setupSockets();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue