Compare commits

...

2 Commits

Author SHA1 Message Date
Derrick Hammer b1ad8399d3
*Update dist 2023-02-25 22:38:46 -05:00
Derrick Hammer 7980aa29c7
*Add websocket compatibility with readyState 2023-02-25 22:38:25 -05:00
3 changed files with 23 additions and 2 deletions

2
dist/socket.d.ts vendored
View File

@ -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;

11
dist/socket.js vendored
View File

@ -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";
}

View File

@ -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) {