phoenix_gen_socket_client
phoenix_gen_socket_client copied to clipboard
Handling WebSocket Timeouts and Reconnection in this client
WebSocket timeout and phoenix_gen_socket_client are not reconnecting to the WebSocket server.
I added a timeout behavior to my server WebSocket in endpoint.ex
:
socket "/socket", MyWeb.UserSocket, websocket: [timeout: 30_000], longpoll: false
Expectation
When the server closes the connection, the client should automatically reconnect to the server.
Behavior
The client does not detect that the server has closed the connection and remains in the joined state. As a result, when the server sends a message to the client, the client does not actually receive it.