samuelpilz / core-catcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect disconnection on the client

samuelpilz opened this issue · comments

The client can detect disconnection when not receiving a response after sending a message. This can be displayed.

Is it not possible to detect the disconnect itself? for example if the websocket has been closed by either of the sides?

This is not easily possible with Websockets elm. There is however a Weboscket.LowLevel module, which can handle this. This, however has a far more complicated interface. Just "subscribung" to the close is not easily possible in Websocket

The solution is to listen if there is no answer after a request has been sent via a time-subscription and cancel that if a response has arrived in time.