mozilla-services / channelserver

🍐 A tool to associate instances of firefox.
Mozilla Public License 2.0
3 stars 6 forks source link

Ability to reconnect websocket when it gets closed #115

Open vbudhram opened 1 month ago

vbudhram commented 1 month ago

I'm not really sure if this is possible, but in https://mozilla-hub.atlassian.net/browse/FXA-10056, the main reason why this was failing was because iOS was closing the websocket connection when the application went into the background.

Unfortunately, we don't have the ability or control when/how this happens. It would be nice to have the ability to reconnect when then application comes back into view.

jrconlin commented 1 month ago

Yeah, mobile devices are exceptionally aggressive about killing battery consuming functions like network (radio) or CPU (functions) so anything that could be shut down absolutely is.

Channelserver is really meant to be a very short-term fix for allowing devices to connect. Honestly, if it takes more than five minutes, we kill the connection (Perhaps that needs to be shorter to account for iOS.)

I'm not quite sure I know what the server can do at this point. The server's role is to open a potential connection, which allows a very limited set of messages to go through, which channel server adds location information. Once a session is joined, if either side drops, both sides are closed. I would suppose that the participants would report an error in that case and the user would be prompted to try again.