chore: noThrowError
This commit is contained in:
1 parent
be91976498
commit
a78bc686cd
1 file changed
+2
-2
@@ -63,7 +63,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
|
|
||||||
close() {
|
close() {
|
||||||
if (this.isClosed) {
|
if (this.isClosed) {
|
||||||
throw new Error('Cannot close a closed WebSocket connection');
|
this.logger.logError('Cannot close a closed WebSocket connection');
|
||||||
}
|
}
|
||||||
this.isClosed = true;
|
this.isClosed = true;
|
||||||
if (this.connection) {
|
if (this.connection) {
|
||||||
@@ -105,7 +105,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WsReply(data: any) {
|
WsReply(data: any) {
|
||||||
if (this.connection?.readyState === NodeWebSocket.OPEN) {
|
if (this.connection?.readyState === NodeWebSocket.OPEN && !this.isClosed) {
|
||||||
this.connection?.send(JSON.stringify(data));
|
this.connection?.send(JSON.stringify(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user