[feat](trx-rs): per-rig watch channels for independent SSE streams
Add per-rig watch::Sender<RigState> map to FrontendRuntimeContext, populated by refresh_remote_snapshot for every rig returned by GetRigs. The SSE /events endpoint now subscribes to the session's rig-specific watch channel instead of the single global one, allowing different browser tabs to independently view different rigs. The JS frontend reconnects SSE on rig switch to pick up the new channel. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -3363,12 +3363,12 @@ async function switchRigFromSelect(selectEl) {
|
||||
updateRigSubtitle(lastActiveRigId);
|
||||
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
||||
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
||||
// Also switch the server's active rig so the SSE stream and audio
|
||||
// follow. Commands already carry rig_id per-tab, but SSE is still
|
||||
// global until per-session streams are implemented.
|
||||
// Switch this session's rig and reconnect SSE to the new rig's
|
||||
// state channel.
|
||||
try {
|
||||
const sidParam = sseSessionId ? `&session_id=${encodeURIComponent(sseSessionId)}` : "";
|
||||
await postPath(`/select_rig?rig_id=${encodeURIComponent(selectEl.value)}${sidParam}`);
|
||||
connect();
|
||||
} catch (err) {
|
||||
console.error("select_rig failed:", err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user