zaidiqbal
(Zaid Iqbal)
May 28, 2022, 2:01pm
10
This is how I achieved this:
zaidiqbal:
One way I can think of is via socket ‘disconnected’ event , so whenever a participant’s ‘disconnected’ event is fired on socket then I will wait for ‘7 seconds’ for ‘connected’ event on socket, as peer state is changed to ‘failed’ around 7 seconds after ‘disconnected’ state if not auto reconnected, if not received then I will emit ‘reconnecting’ event to all other participants and on that event on client side I will show ‘connecting…’ for that participant’s video box.
As for how to restore rtc connection after it goes to ‘failure’ state:
You will have to manually close the transport and it’s producers and consumers and then create a new transport and producers and consumer on top of that to achieve reflow of streams.
Also read comments mentioned here:
Web Socket Server (Chat/Signaling):
Your Web Sockets will know if a user had closed connection or had timed-out (disconnected via heartbeat).
These two states should generally be treated the same and end with user data/transport termination as well as a message to all the other users that someone left (additional clean-up if necessary).
Broadcasts (Producers):
This is best handled both server-sided and client-sided when handling connection issues.
Server Sided: You monitor for DTLS state …