elm-phoenix icon indicating copy to clipboard operation
elm-phoenix copied to clipboard

Force reconnect

Open Zinggi opened this issue 6 years ago • 0 comments

First off, huge thanks for creating this great library, it has a very nice API and just works! Now to my issue:


Is it possible to force trying to reconnect immediately once the connection to a websocket was lost, e.g. a function like: tryReconnect : Socket -> List (Channel msg) -> Cmd msg


My use case is the following: I have an application that uses chanels to exchange messages 'directly' between multiple devices of a user. (e.g. PC to phone) For some of these messages, it is important that they are delivered as quickly as possible.

This is no problem when both devices have the website open. However, if the phone is locked, it loses the connection. If I then want to send a message from my PC to the phone, I expect that the phone will receive the message as soon as I unlock it. However, since there doesn't seem to be a way to immediately connect to the socket, a user now has to wait up to 30 seconds before the message is delivered.

With a function that would try to reconnect immediately, I could solve this easily by calling it every time the user unlocks the phone.

I hope that made sense.

Zinggi avatar May 11 '18 14:05 Zinggi