From b1ad8399d335eab0f032035837dfe00263d458e0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 25 Feb 2023 22:38:46 -0500 Subject: [PATCH] *Update dist --- dist/socket.d.ts | 2 +- dist/socket.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/socket.d.ts b/dist/socket.d.ts index 8d83d51..0dce129 100644 --- a/dist/socket.d.ts +++ b/dist/socket.d.ts @@ -23,7 +23,7 @@ export default class Socket extends Duplex { constructor({ allowHalfOpen, remoteAddress, remotePort, remotePublicKey, write, emulateWebsocket, }?: SocketOptions); private _connecting; get connecting(): boolean; - get readyState(): string; + get readyState(): string | number; listen(): void; setTimeout(msecs: any, callback: any): void; _onTimeout(): void; diff --git a/dist/socket.js b/dist/socket.js index 16fd673..86ae9f1 100644 --- a/dist/socket.js +++ b/dist/socket.js @@ -37,6 +37,17 @@ class Socket extends streamx_1.Duplex { return this._connecting; } get readyState() { + if (this._emulateWebsocket) { + if (this._connecting) { + return 0; + } + else if (this.readable && this.writable) { + return 1; + } + else { + return 3; + } + } if (this._connecting) { return "opening"; }