*Add websocket compatibility with readyState

This commit is contained in:
Derrick Hammer 2023-02-25 22:38:25 -05:00
parent d94eec7c7e
commit 7980aa29c7
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 1 deletions

View File

@ -70,7 +70,17 @@ export default class Socket extends Duplex {
return this._connecting; 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) { if (this._connecting) {
return "opening"; return "opening";
} else if (this.readable && this.writable) { } else if (this.readable && this.writable) {