Retry message sending when websocket not ready

This commit is contained in:
Alexandre Iooss 2020-10-22 13:42:45 +02:00
parent 0f4c57bcde
commit 24478bdc7a
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,8 @@ export class GsWebSocket {
*/
sendDescription(localDescription, stream, quality) {
if (this.socket.readyState !== 1) {
console.log("WebSocket not ready to send data");
console.log("Waiting for WebSocket to send data...");
setTimeout(() => this.sendDescription(localDescription, stream, quality), 100);
return;
}
this.socket.send(JSON.stringify({