*Add websocket compatibility with readyState
This commit is contained in:
parent
d94eec7c7e
commit
7980aa29c7
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue