Skip to content

Ask for a reload when the live view drops, and only say shut down when it is - #488

Draft
tnsardesai wants to merge 2 commits into
mainfrom
hypeship/live-view-reconnect
Draft

tnsardesai wants to merge 2 commits into
mainfrom
hypeship/live-view-reconnect

Conversation

@tnsardesai

@tnsardesai tnsardesai commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The live view showed "Browser has been shut down and is no longer available" whenever its connection dropped after connecting, whether or not the browser was gone. app.vue renders that overlay for any !connected && wasConnected. So a network change, or a TURN relay that stops answering, told the viewer the browser had shut down while it was still running. A viewer who believes the browser is gone doesn't reload, so the session stops counting as active and can idle out shortly after, which then makes the message true.

This makes the overlay say which one happened. It doesn't add automatic retry: #417's decision stands, and a connected viewer that drops still ends the connection and posts nothing new to the parent frame.

Ship after kernel/kernel#5023 is deployed. That change makes the live-view proxy close a connected viewer with 4410 when the session has ended. Before it, every teardown reaches this client as an ordinary close, so a viewer on a released pooled browser would be told to reload the page, and pooled sessions keep the same token across leases.

Changes

  • Two overlay messages.
    • The proxy closed the socket with 4410 (session gone): "Browser has been shut down and is no longer available", as before.
    • Any other close after connecting: "Lost connection to the browser. Reload the page to reconnect."
  • neko's connection shutdown no longer pops a modal. neko sends system/disconnect with connection shutdown as it stops, on a restart and on browser teardown alike, and the client treated it as a server disconnect with a "Disconnected" modal over the overlay. That message is now left to the socket close that follows, which decides the message. Other server reasons (kicked, connection replaced, ...) are unchanged.
  • First connects are unchanged: same stage bounds, same single terminal parent event.

Testing

  • bun test tests: 256 pass. New tests:

    • a 4410 close after connecting marks the session gone and opens no new socket;
    • any other close after connecting leaves it not gone and opens no new socket;
    • the overlay state for a gone and a not-gone disconnect;
    • connection shutdown versus other server disconnect reasons.

    5 of them fail against main.

  • npm run build passes, with the same 17 lint warnings as main. Prettier is clean. The production bundle still contains the websocket URL string the proxy rewrites to append the token, exactly once.

  • End to end on a production headful image with this branch's client (8496fdf, bundle app.67103f2f.js) swapped in, driven from headless Chromium 155. Each case held the overlay for 15s to check nothing reconnected on its own, then reloaded the page:

    Trigger Result
    Outbound UDP dropped on the viewer's machine (ICE fails about 5s in) "Lost connection to the browser. Reload the page to reconnect." 5s in, no modal, no new socket in the next 15s; reloading the page had video playing 2s later
    supervisorctl restart neko the same message at once, no modal, no new socket; reloading once neko was back had video playing 2s later
    Browser deleted while viewing (production proxy, without kernel/kernel#5023) the same message 3s after the delete, no modal, no new socket; reloading the page returned 410 "Browser session no longer exists"

    On main, the first two show "Browser has been shut down" with the browser still running. With kernel/kernel#5023 deployed, the third should show "Browser has been shut down" instead; that path is covered by unit tests here and by the proxy tests in kernel/kernel#5023.

Not covered: the image build and a fresh boot with this client, and Safari or Firefox.

@tnsardesai
tnsardesai force-pushed the hypeship/live-view-reconnect branch from 2b99563 to 0e05bf3 Compare October 27, 2026 04:56
@tnsardesai tnsardesai changed the title Reconnect the live view after a drop, and only say shut down when it is Ask for a reload when the live view drops, and only say shut down when it is Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant