added socket flags
This commit is contained in:
parent
1447a21c8c
commit
acdcd1330f
@ -233,6 +233,7 @@ Node.prototype.setupSockets = function()
|
|||||||
})
|
})
|
||||||
.on('timeout', function ()
|
.on('timeout', function ()
|
||||||
{
|
{
|
||||||
|
self._socket = false;
|
||||||
console.error('wsc', 'Socket connection timeout');
|
console.error('wsc', 'Socket connection timeout');
|
||||||
})
|
})
|
||||||
.on('close', function ()
|
.on('close', function ()
|
||||||
@ -247,6 +248,7 @@ Node.prototype.setupSockets = function()
|
|||||||
})
|
})
|
||||||
.on('online', function ()
|
.on('online', function ()
|
||||||
{
|
{
|
||||||
|
self._socket = true;
|
||||||
console.info('wsc', 'Network connection is online');
|
console.info('wsc', 'Network connection is online');
|
||||||
})
|
})
|
||||||
.on('reconnect', function ()
|
.on('reconnect', function ()
|
||||||
@ -255,19 +257,23 @@ Node.prototype.setupSockets = function()
|
|||||||
})
|
})
|
||||||
.on('reconnect scheduled', function (opts)
|
.on('reconnect scheduled', function (opts)
|
||||||
{
|
{
|
||||||
|
self._socket = false;
|
||||||
console.warn('wsc', 'Reconnecting in', opts.scheduled, 'ms');
|
console.warn('wsc', 'Reconnecting in', opts.scheduled, 'ms');
|
||||||
console.warn('wsc', 'This is attempt', opts.attempt, 'out of', opts.retries);
|
console.warn('wsc', 'This is attempt', opts.attempt, 'out of', opts.retries);
|
||||||
})
|
})
|
||||||
.on('reconnected', function (opts)
|
.on('reconnected', function (opts)
|
||||||
{
|
{
|
||||||
|
self._socket = true;
|
||||||
console.success('wsc', 'Socket reconnected successfully after', opts.duration, 'ms');
|
console.success('wsc', 'Socket reconnected successfully after', opts.duration, 'ms');
|
||||||
})
|
})
|
||||||
.on('reconnect timeout', function (err, opts)
|
.on('reconnect timeout', function (err, opts)
|
||||||
{
|
{
|
||||||
|
self._socket = false;
|
||||||
console.error('wsc', 'Socket reconnect atempt took too long:', err.message);
|
console.error('wsc', 'Socket reconnect atempt took too long:', err.message);
|
||||||
})
|
})
|
||||||
.on('reconnect failed', function (err, opts)
|
.on('reconnect failed', function (err, opts)
|
||||||
{
|
{
|
||||||
|
self._socket = false;
|
||||||
console.error('wsc', 'Socket reconnect failed:', err.message);
|
console.error('wsc', 'Socket reconnect failed:', err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user