Merge pull request #2 from PeterTheOne/patch-1

fixed initialization of websocket
This commit is contained in:
phahulin 2019-09-09 17:10:57 +03:00 committed by GitHub
commit f4d30aa024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -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();
}
}