From e3b77600500289acca4aca96d418f25d1d1780b8 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 1 Sep 2023 21:01:24 -0400 Subject: [PATCH] fix: need to use close not end on WS transport --- src/transports/webSocket.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transports/webSocket.ts b/src/transports/webSocket.ts index da2b657..8a86caf 100644 --- a/src/transports/webSocket.ts +++ b/src/transports/webSocket.ts @@ -3,8 +3,10 @@ import { URL } from "url"; import * as WS from "ws"; import { BasePeer } from "#transports/base.js"; import isNode from "detect-node"; +import net from "net"; export class WebSocketPeer extends BasePeer implements Peer { + declare _socket: WebSocket; sendMessage(message: Uint8Array): void { this._socket.send(message); } @@ -43,7 +45,7 @@ export class WebSocketPeer extends BasePeer implements Peer { } } end(): void { - this._socket.end(); + this._socket.close(); } public static async connect(uri: URL): Promise {