phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
6k stars 906 forks source link

remove server close listener when disconnecting #3279

Closed SteffenDE closed 1 month ago

SteffenDE commented 1 month ago

This fixes an inconsistency between bandit and cowboy. When closing the socket connection and using cowboy, we'd receive a code 1005, but when running with bandit we'd receive code 1000. LiveView currently reacts to code 1000 by doing a failsafe reload, therefore you cannot close the socket when using bandit without reloading the page.

This should be the correct way to do it: removing the server close handler when the reason for closing is the client intentionally disconnecting.

chrismccord commented 1 month ago

❤️❤️❤️🐥🔥