phoenix_gen_socket_client icon indicating copy to clipboard operation
phoenix_gen_socket_client copied to clipboard

Handling WebSocket Timeouts and Reconnection in this client

Open alexaung98 opened this issue 9 months ago • 3 comments

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.

alexaung98 avatar May 24 '24 03:05 alexaung98