phoenix_gen_socket_client
phoenix_gen_socket_client copied to clipboard
Fix disconnect callback for latest versions of `websocket_client`
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.