Skip to content

Commit 0a35a46

Browse files
authored
Fixed #661 (#662)
- Fixed bug on ws listener status for injected object
1 parent 1005210 commit 0a35a46

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/infrastructure/Listener.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class Listener implements IListener {
100100
*/
101101
public open(): Promise<void> {
102102
return new Promise((resolve, reject) => {
103-
if (this.webSocket === undefined || this.webSocket.readyState === WebSocket.CLOSED) {
103+
if (this.webSocket === undefined || this.webSocket.readyState === this.webSocket.CLOSED) {
104104
if (this.websocketInjected) {
105105
this.webSocket = new this.websocketInjected(this.url);
106106
} else {
@@ -197,7 +197,7 @@ export class Listener implements IListener {
197197
*/
198198
public isOpen(): boolean {
199199
if (this.webSocket) {
200-
return this.webSocket.readyState === WebSocket.OPEN;
200+
return this.webSocket.readyState === this.webSocket.OPEN;
201201
}
202202
return false;
203203
}
@@ -207,7 +207,10 @@ export class Listener implements IListener {
207207
* @returns void
208208
*/
209209
public close(): void {
210-
if (this.webSocket && (this.webSocket.readyState === WebSocket.OPEN || this.webSocket.readyState === WebSocket.CONNECTING)) {
210+
if (
211+
this.webSocket &&
212+
(this.webSocket.readyState === this.webSocket.OPEN || this.webSocket.readyState === this.webSocket.CONNECTING)
213+
) {
211214
this.webSocket.close();
212215
}
213216
}

0 commit comments

Comments
 (0)