polfan-server-js-client 0.2.53 → 0.2.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.53",
3
+ "version": "0.2.54",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -80,7 +80,7 @@ export class WebSocketChatClient extends AbstractChatClient implements Observabl
80
80
 
81
81
  this.handleEnvelopeSendError(
82
82
  envelope,
83
- new Error(`Cannot send; invalid websocket state=${this.ws?.readyState}`)
83
+ new Error(`Cannot send; invalid websocket state=${this.ws?.readyState ?? '[no connection]'}`)
84
84
  );
85
85
  }
86
86
 
@@ -131,10 +131,10 @@ export class WebSocketChatClient extends AbstractChatClient implements Observabl
131
131
  }
132
132
 
133
133
  private isPendingReadyWsState(): boolean {
134
- return this.ws.readyState === this.ws.CONNECTING || !this.authenticated;
134
+ return this.ws && this.ws.readyState === this.ws.CONNECTING || !this.authenticated;
135
135
  }
136
136
 
137
137
  private isReadyToSendWsState(): boolean {
138
- return this.ws?.readyState === this.ws.OPEN && this.authenticated;
138
+ return this.ws && this.ws.readyState === this.ws.OPEN && this.authenticated;
139
139
  }
140
140
  }