diff --git a/src/net.ts b/src/net.ts index 078cc1a..31e4888 100644 --- a/src/net.ts +++ b/src/net.ts @@ -20,7 +20,7 @@ export default class Socket extends Duplex { if (event === "message") { sendEvent = "data"; - sendData[0] = (args[0] as MessageEvent).data + "\n" as any; + sendData[0] = ((args[0] as MessageEvent).data + "\n") as any; } // @ts-ignore return this.emit(sendEvent, ...sendData); @@ -32,6 +32,10 @@ export default class Socket extends Duplex { this._ws.send(data); cb(); } + _destroy(cb: any) { + this._ws.close(); + cb(); + } setEncoding() {} } export function connect(