fix(core): update
This commit is contained in:
parent
8d358dd93d
commit
075c59ed2c
@ -70,6 +70,14 @@ export class SmartsocketClient {
|
|||||||
this.socketConnection.listenToFunctionRequests();
|
this.socketConnection.listenToFunctionRequests();
|
||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// handle errors
|
||||||
|
this.socketConnection.socket.on('reconnect_failed', async () => {
|
||||||
|
this.disconnect();
|
||||||
|
});
|
||||||
|
this.socketConnection.socket.on('connect_error', async () => {
|
||||||
|
this.disconnect();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
@ -78,9 +86,18 @@ export class SmartsocketClient {
|
|||||||
* disconnect from the server
|
* disconnect from the server
|
||||||
*/
|
*/
|
||||||
public async disconnect() {
|
public async disconnect() {
|
||||||
this.socketConnection.socket.disconnect(true);
|
if (this.socketConnection) {
|
||||||
this.socketConnection = undefined;
|
this.socketConnection.socket.disconnect(true);
|
||||||
plugins.smartlog.defaultLogger.log('ok', 'disconnected!');
|
this.socketConnection = undefined;
|
||||||
|
plugins.smartlog.defaultLogger.log('ok', 'disconnected!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* try a reconnection
|
||||||
|
*/
|
||||||
|
public async tryReconnect() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user