fix: need to use close not end on WS transport
This commit is contained in:
parent
905c35aed1
commit
e3b7760050
|
@ -3,8 +3,10 @@ import { URL } from "url";
|
||||||
import * as WS from "ws";
|
import * as WS from "ws";
|
||||||
import { BasePeer } from "#transports/base.js";
|
import { BasePeer } from "#transports/base.js";
|
||||||
import isNode from "detect-node";
|
import isNode from "detect-node";
|
||||||
|
import net from "net";
|
||||||
|
|
||||||
export class WebSocketPeer extends BasePeer implements Peer {
|
export class WebSocketPeer extends BasePeer implements Peer {
|
||||||
|
declare _socket: WebSocket;
|
||||||
sendMessage(message: Uint8Array): void {
|
sendMessage(message: Uint8Array): void {
|
||||||
this._socket.send(message);
|
this._socket.send(message);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +45,7 @@ export class WebSocketPeer extends BasePeer implements Peer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end(): void {
|
end(): void {
|
||||||
this._socket.end();
|
this._socket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async connect(uri: URL): Promise<WebSocket> {
|
public static async connect(uri: URL): Promise<WebSocket> {
|
||||||
|
|
Loading…
Reference in New Issue