diff --git a/shims/net/index.ts b/shims/net/index.ts index 2136263..781b9ff 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -501,7 +501,9 @@ export class Socket extends EventEmitter { if (this.writeBuffer === undefined) { this.writeBuffer = data; setTimeout(() => { - this.ws!.send(this.writeBuffer!); + if(this.ws) { + this.ws!.send(this.writeBuffer!); + } this.writeBuffer = undefined; }, 0); } else {