Way to sync up to host
There is no way for viewers to sync to the host if they get disconnected
Suggestion: send an initial "sync" packet on connect.
Also suggest having # urls (such as domain.herokuapp.com/#/r/1) so that a viewer that has to reconnect can refresh the page and still stay in the same room
Having more experience with the app now, I realize that I misinterpreted the issue.
Instead I suggest a "heartbeat". Not exactly sure what the method is that fails when a client is disconnected from the sync, but the symptoms are clear:
- User and host both continue watching the video, but now there's no communication between the two. Play/pause has no effect on the disconnected one, and there's no position syncing.
- The username may silently drop from the list of users in the room (needs more observation, but I suspect there's a delay here)
- A refresh from the disconnected user is needed to regain the connection
Heartbeats are excellent in these cases:
- If it's at X seconds, the host knows when a user has dropped to within at least X*2 (one lost is an anomaly, two is the beginning of a pattern)
- If there is a confirmation returned, the client knows when their connection has been lost. This can resent a warning in the UI, as well as cause the client to start a reconnect attempt
In addition, the heartbeat can be used to relay timestamp sync data
And, to mitigate any problems:
- If each heartbeat has a unique ID, accidental duplicates are not possible