fix: need to use close not end on WS transport

This commit is contained in:
Derrick Hammer 2023-09-01 21:01:24 -04:00
parent 905c35aed1
commit e3b7760050
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -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<WebSocket> {