Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5e60d804a | |||
c5d52013e6 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "1.2.20",
|
||||
"version": "1.2.21",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "1.2.20",
|
||||
"version": "1.2.21",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "1.2.20",
|
||||
"version": "1.2.21",
|
||||
"description": "easy and secure websocket communication",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
|
@ -7,4 +7,5 @@ export type TConnectionStatus =
|
||||
| 'connecting'
|
||||
| 'connected'
|
||||
| 'disconnecting'
|
||||
| 'disconnected';
|
||||
| 'disconnected'
|
||||
| 'timedOut';
|
||||
|
@ -118,6 +118,7 @@ export class SmartsocketClient {
|
||||
const timer = new plugins.smarttime.Timer(5000);
|
||||
timer.start();
|
||||
timer.completed.then(() => {
|
||||
this.updateStatus('timedOut');
|
||||
logger.log('warn', 'connection to server timed out.');
|
||||
this.disconnect(true);
|
||||
});
|
||||
@ -189,7 +190,7 @@ export class SmartsocketClient {
|
||||
/**
|
||||
* disconnect from the server
|
||||
*/
|
||||
public async disconnect(useAutoconnectSetting = false) {
|
||||
public async disconnect(useAutoReconnectSetting = false) {
|
||||
if (this.disconnectRunning) {
|
||||
return;
|
||||
}
|
||||
@ -209,7 +210,7 @@ export class SmartsocketClient {
|
||||
logger.log('warn', `disconnected from server ${this.remoteShortId}`);
|
||||
this.remoteShortId = null;
|
||||
|
||||
if (this.autoReconnect && useAutoconnectSetting && this.eventStatus !== 'connecting') {
|
||||
if (this.autoReconnect && useAutoReconnectSetting && this.eventStatus !== 'connecting') {
|
||||
this.updateStatus('connecting');
|
||||
await this.tryDebouncedReconnect();
|
||||
this.disconnectRunning = false;
|
||||
|
Reference in New Issue
Block a user