elm-phoenix
elm-phoenix copied to clipboard
Wifi off doesn't trigger errors
Pulled out from #27 @bigardone:
The issue I'm having is that once the connection is made and the channel is joined, if I turn off the wifi it is not receiving any error or anything (not even the onAbnormalClose), until it reaches the socket timeout (which is set to 45 seconds). What I have done is creating a new out port which it is called as the window.navigator.onLine event handlers (https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine), so it detects it immediately. Does it make sense?
@bigardone I think an error should be thrown for this scenario. To find out what is (not) happening I think you should start here.
This action should be triggered from the underlying websocket package. Is there a message after you turn off the wifi? Is there an error code? (Here is a list of the error codes).
There is also a Socket.withDebug
method which should give you more information.
If Die
is not triggered, you could dig deeper into the underlying websocket package. The relevant interaction with it happens here.
Hope this helps you, but if your current solution is working reliable I completely understand if you don't do anything ☺️
@saschatimme I totally agree on that. I'm going to investigate a bit more and share here what I discover in the process :)