1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-24 16:02:20 +00:00

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

View File

@ -39,7 +39,8 @@ export class GsWebSocket {
*/ */
sendDescription(localDescription, stream, quality) { sendDescription(localDescription, stream, quality) {
if (this.socket.readyState !== 1) { 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; return;
} }
this.socket.send(JSON.stringify({ this.socket.send(JSON.stringify({