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,10 +86,19 @@ export class SmartsocketClient {
|
|||||||
* disconnect from the server
|
* disconnect from the server
|
||||||
*/
|
*/
|
||||||
public async disconnect() {
|
public async disconnect() {
|
||||||
|
if (this.socketConnection) {
|
||||||
this.socketConnection.socket.disconnect(true);
|
this.socketConnection.socket.disconnect(true);
|
||||||
this.socketConnection = undefined;
|
this.socketConnection = undefined;
|
||||||
plugins.smartlog.defaultLogger.log('ok', 'disconnected!');
|
plugins.smartlog.defaultLogger.log('ok', 'disconnected!');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* try a reconnection
|
||||||
|
*/
|
||||||
|
public async tryReconnect() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispatches a server call
|
* dispatches a server call
|
||||||
|
Loading…
Reference in New Issue
Block a user