A live socket stays with the machine it was opened for

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-21 23:53:18 -07:00
co-authored by Claude Opus 5
parent 3c7e46104c
commit 5412e316de
3 changed files with 18 additions and 2 deletions
+4 -1
View File
@@ -52,9 +52,12 @@ export function Logs({ unit }: { unit: string }) {
let readyTimer: number | undefined
let sock: WebSocket | null = null
let retry: number | undefined
// fixed when the log opens, for the same reason as a terminal's: a reconnect must not
// follow the console to another machine
const url = wsURLPath(`/api/services/${encodeURIComponent(unit)}/logs/tail?n=200`)
const connect = () => {
if (closed) return
const s = new WebSocket(wsURLPath(`/api/services/${encodeURIComponent(unit)}/logs/tail?n=200`))
const s = new WebSocket(url)
sock = s
s.onopen = () => { setLive(true); setErr(''); readyTimer = window.setTimeout(() => setReady(true), 1500) }
s.onmessage = (ev) => {