LiveReload Websocket Connection closes without error and prevents development features

I noticed about a few months ago that on certain parts of my website, in development, I saw the below console message:

Screenshot 2025-08-11 at 9.57.42 AM

I might have also noticed a correlating lack of live reloading functionality when the code changed, but I didn’t have a direct connection until now. Part of the 1.8 release was defaulting to having the web_console_logger option set to true. Now I’m noticing that it’s not just the live reloading, but also when I see this message I also don’t ever see any console logs from Phoenix! This was likely always the ase, but now that it’s defautled to on it’s very noticeable.

Some things to note:

  • I have a fairly standard setup, but I’ve configured a few things beyond the normal.
  • It’s intermittent.
  • Refresh and hard refresh doesn’t fix it.
  • Restarting the server doesn’t fix it.
  • I’m accessing the website not via localhost directly, but via a /etc/hosts subdomain pointing to 0.0.0.0.
  • I use https locally with a self-signed certificate and also wss.
  • There’s no error messages in either server logs or the websocket messages.
  • No other part of the application seems to have a problem.

However something does reset it because at least twice today I saw the web console logs for a brief period of time.

Are you using Brave? If so, check out WebSocket is closed before the connection is established

Nope, I’m using Chrome and Firefox.