Reliability and persistence of Phoenix sockets / channels

For an upcoming project I want to allow users playing an online game (using web browsers on cellular phones over WiFI / 3G / LTE) to subscribe to channels., They will receive new tasks from game moderator. The online game might last 2 hours. They must receive the tasks in real time.

My questions:

  1. How reliable Phoenix sockets / channels are for such a project.

  2. How to ensure that all end users will be connected and able to receive the broadcasts in real time (and not missing even a single one)? Is there some mechanisms which can be implemented to make sure they get re-connected in case of interruption?

  3. Can the moderator see if some users have lost the live web socket connection to the server?

Thank you.

The first fallacy of distributed computing: The network is relyable.

Phoenix can just be as reliable as the network connection you have to your devices. As we’re talking about distributed computation you’re in the realms where you can never know if the recipient of a message did receive your message, received it, but failed to process it, or if a response just didn’t arrive. Therefore detecting if a user is connected/disconnected is mostly fancy guesswork, which you can tray to tune with heartbeats and timeouts, but it can by definition never be 100% correct.

Channels do use heartbeats and timeouts to detect disconnection and the js client does also periodically (with growing backoff) try to reconnect to the server.


I believe there were a number of reconnect improvements in the past couple of releases as well.