Skip to content

Commit

Permalink
Check for ws readystate before attempting to send signal request (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Oct 26, 2022
1 parent 00dbd21 commit 859a103
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-boats-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Check for ws readystate before attempting to send signal request
4 changes: 2 additions & 2 deletions src/api/SignalClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ export class SignalClient {
if (this.signalLatency) {
await sleep(this.signalLatency);
}
if (!this.ws) {
log.error('cannot send signal request before connected');
if (!this.ws || this.ws.readyState < this.ws.OPEN) {
log.error(`cannot send signal request before connected, type: ${message?.$case}`);
return;
}

Expand Down

0 comments on commit 859a103

Please sign in to comment.