LiveView falls back to longpoll after dev server restart

I’ve noticed that when I kill and restart the Phoenix dev server, all existing browser tabs with a LiveView reconnect back to the server using longpoll (and stick to using longpoll). If I open a new tab, the LiveView connects using websocket.

I can’t say I’ve noticed this before, and I’m not sure if this is expected behaviour or something I’ve tweaked and set up wrong?

https://github.com/phoenixframework/phoenix/issues/5720

This snippet may help (it disables the fallback altogether in the dev env):

let liveSocket = new LiveSocket("/live", Socket, {
  longPollFallbackMs: window.location.host.startsWith("localhost")
    ? undefined
    : 3000,
    ...
})

This PR might address this issue…

https://github.com/phoenixframework/phoenix/pull/6208