feat(runtime): refactor runtime state and proxy event handling for typed WebRTC linking and shared status models

This commit is contained in:
2026-04-14 10:45:59 +00:00
parent 5a280c5c41
commit 51f7560730
15 changed files with 1105 additions and 813 deletions
+4 -11
View File
@@ -5,8 +5,8 @@
* - Browser device registration/unregistration via WebSocket
* - WS → deviceId mapping
*
* All WebRTC media logic (PeerConnection, RTP, transcoding) lives in
* ts/call/webrtc-leg.ts and is managed by the CallManager.
* All WebRTC media logic (PeerConnection, RTP, transcoding, mixer wiring)
* lives in the Rust proxy-engine. This module only tracks browser sessions.
*/
import { WebSocket } from 'ws';
@@ -39,7 +39,7 @@ export function initWebRtcSignaling(cfg: IWebRtcSignalingConfig): void {
/**
* Handle a WebRTC signaling message from a browser client.
* Only handles registration; offer/ice/hangup are routed through CallManager.
* Only handles registration; offer/ice/hangup are routed through frontend.ts.
*/
export function handleWebRtcSignaling(
ws: WebSocket,
@@ -51,7 +51,7 @@ export function handleWebRtcSignaling(
handleRegister(ws, message.sessionId!, message.userAgent, message._remoteIp);
}
// Other webrtc-* types (offer, ice, hangup, accept) are handled
// by the CallManager via frontend.ts WebSocket handler.
// by the frontend.ts WebSocket handler and forwarded to Rust.
}
/**
@@ -64,13 +64,6 @@ export function sendToBrowserDevice(deviceId: string, data: unknown): boolean {
return true;
}
/**
* Get the WebSocket for a browser device (used by CallManager to create WebRtcLegs).
*/
export function getBrowserDeviceWs(deviceId: string): WebSocket | null {
return deviceIdToWs.get(deviceId) ?? null;
}
/**
* Get all registered browser device IDs.
*/