feat(): slight improvement around ws teardown. feat(#305): implement safe terminate for browsers
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
||||
isTopicSubscriptionSuccess,
|
||||
isWsPong,
|
||||
neverGuard,
|
||||
safeTerminateWs,
|
||||
serializeParams,
|
||||
} from './util';
|
||||
import { RestClientV5 } from './rest-client-v5';
|
||||
@@ -462,7 +463,7 @@ export class WebsocketClient extends EventEmitter {
|
||||
const ws = this.getWs(wsKey);
|
||||
ws?.close();
|
||||
if (force) {
|
||||
ws?.terminate();
|
||||
safeTerminateWs(ws);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,7 +812,12 @@ export class WebsocketClient extends EventEmitter {
|
||||
this.clearPingTimer(wsKey);
|
||||
this.clearPongTimer(wsKey);
|
||||
|
||||
this.getWs(wsKey)?.terminate();
|
||||
const ws = this.getWs(wsKey);
|
||||
|
||||
if (ws) {
|
||||
ws.close();
|
||||
safeTerminateWs(ws);
|
||||
}
|
||||
|
||||
if (!wasOpen) {
|
||||
this.logger.info(
|
||||
|
||||
Reference in New Issue
Block a user