Skip to content

Commit bf816cc

Browse files
committed
Added isOpen function for the listener
1 parent be669ab commit bf816cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/infrastructure/Listener.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ export class Listener {
157157
});
158158
}
159159

160+
/**
161+
* returns a boolean that repressents the open state
162+
* @returns a boolean
163+
*/
164+
public isOpen(): boolean {
165+
if(this.webSocket){
166+
return this.webSocket.readyState === WebSocket.OPEN;
167+
}
168+
return false;
169+
}
170+
160171
/**
161172
* Close web socket connection.
162173
* @returns void

0 commit comments

Comments
 (0)