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:
co-authored by
Claude Opus 5
parent
3c7e46104c
commit
5412e316de
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user