phoenix_gen_socket_client icon indicating copy to clipboard operation
phoenix_gen_socket_client copied to clipboard

Fix disconnect callback for latest versions of `websocket_client`

Open jdav-dev opened this issue 10 months ago • 0 comments

In websocket_client versions 1.4.0 and later, the ondisconnect/2 callback is only triggered in the connected and handshaking states. This causes the tcp_closed message to go to the websocket_info/3 callback instead of invoking the ondisconnect/2 callback. See https://github.com/sanmiguel/websocket_client/pull/78 for more info.

As it is now, phoenix_gen_socket_client silently ignores unknown websocket_info/3 messages. The Phoenix Channel client becomes disconnected without invoking any of its callbacks.

This commit updates the built-in transport to maintain consistent behavior through the latest versions of websocket_client.

jdav-dev avatar Mar 13 '25 14:03 jdav-dev