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
+5 -1
View File
@@ -60,9 +60,13 @@ export default function TerminalPane({ id, active, register, onStatus, onExit }:
sendResize()
}
// The address is fixed when the pane opens, not rebuilt on each attempt: it carries which
// machine this terminal belongs to, and the console may have moved to another machine
// before a reconnect fires — which had the hub's terminals being asked for on a node.
const url = wsURL(id)
const connect = () => {
if (closed) return
const sock = new WebSocket(wsURL(id))
const sock = new WebSocket(url)
sock.binaryType = 'arraybuffer'
ws = sock
sock.onopen = () => { retry = 0; setConn('open'); cbs.current.onStatus(true); lastSize = ''; doFit(); while (queued.length) sock.send(enc.encode(queued.shift()!)) }