diff --git a/src/socket.ts b/src/socket.ts index 5f21b0b..1bcf738 100644 --- a/src/socket.ts +++ b/src/socket.ts @@ -70,7 +70,17 @@ export default class Socket extends Duplex { return this._connecting; } - get readyState(): string { + get readyState(): string | number { + if (this._emulateWebsocket) { + if (this._connecting) { + return 0; + } else if (this.readable && this.writable) { + return 1; + } else { + return 3; + } + } + if (this._connecting) { return "opening"; } else if (this.readable && this.writable) {