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.

1 Like

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.

1 Like

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.

1 Like

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

5 Likes

Same issue here. I have a Brave window open, and my http://localhost tab is continually reloading, while the same URL being accessed via https://xxxxxxxx.ngrok.io 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.

1 Like

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

5 Likes

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

I deal with this almost daily on localhost (with ngrok it’s a bit better), but it seems like there’s finally some movement:

and

2 Likes