Phoenix livereload / liveview connection issue

I started a new liveview project on Erlang/OTP 24, Elixir 1.12.1, and with the latest liveview packages.

My problem is that both livereload and liveview websocket connections timeouts and I have basically a vanilla project.

It seems to work for a small amount of time if I switch to incognito mode or often if I restart the server.
I triple checked all the configuration and everything’s fine.

Anyone encounters this issue? I’m going crazy with the development.

Are you using Brave by any chance? We had a couple reports from Brave users where web sockets would be pending on the 101 upgrade. Everything that I’ve seen pointed to a brave issue as the websocket upgrade did not appear to be sent to the server.

hello, yes, I’m using brave :\

however occasionally I have the same issue on Opera, as I’ve tried switching browser.
I’m trying going back to Chrome then, thanks.

The last report I got only happened when using the adguard plugin with Brave, and it required a full brave restart to fix. I honestly don’t believe it’s anything we can fix on our side.

I would be curious to see if disabling live reload fixed it, where maybe two websocket connections to the same host borked Brave for some reason. That or delaying the websocket connection until DOMContentReady if Brave has an issue with how aggressively we try to connect on js load, but I am completely spitballing.

1 Like

I got the same problem on brave browser. Using https in dev solved the issue.
I am also using a custom domain myproject.local and some *.myproject.local instead of localhost not sure if it matter.
I used mkcert but it should probably work using the mix task Using SSL — Phoenix v1.5.12


Same issue here. I have a Brave window open, and my http://localhost tab is continually reloading, while the same URL being accessed via is working fine.

Hard to say if it’s a hostname issue or an http/https issue with Brave, but using grok definitely fixed it for me.

for posterity, Brave has an ongoing and unaddressed websocket issue with multiple webservers/frameworks WebSocket sometimes fails to reconnect until browser restart or website access from incognito mode · Issue #15410 · brave/brave-browser · GitHub

1 Like

According to [Brave Shield] - Brave's unbreak list directly identifies you as a Brave user · Issue #10165 · brave/brave-browser · GitHub you can detect if browser is brave with typeof navigator?.brave?.isBrave === 'function'. Maybe show a warning when Brave is detected if user wants to continue?
It doesn’t seem like fixing WebSocket support is not high on Brave team’s list or they would have fixed it already. Kind of sad since many web sites rely on WebSocket support for realtime events.

1 Like