pub struct BridgeServer { /* private fields */ }Expand description
A running bridge instance: both loopback-TCP planes bound and serving, with
a CancellationToken for graceful shutdown.
Created by BridgeServer::start, which returns once the planes are bound
(fail-closed) and the accept loops are spawned. A standalone serve calls
wait (run until Ctrl-C); a supervisor (the daemon) instead
drives status / disconnect_tab /
shutdown directly.
Implementations§
Source§impl BridgeServer
impl BridgeServer
Sourcepub async fn start(config: BridgeConfig, token: String) -> Result<Self>
pub async fn start(config: BridgeConfig, token: String) -> Result<Self>
Binds both planes (fail-closed), spawns the accept loops, and returns
immediately. token is the already-resolved session token (never
sourced from argv).
Sourcepub fn control_port(&self) -> u16
pub fn control_port(&self) -> u16
The bound control-plane port (resolved if 0 was requested).
Sourcepub fn status(&self) -> StatusResponse
pub fn status(&self) -> StatusResponse
A synchronous snapshot of connection status (the same payload the
GET /__bridge/status endpoint returns).
Sourcepub fn disconnect_tab(&self, id: u64) -> Result<()>
pub fn disconnect_tab(&self, id: u64) -> Result<()>
Disconnects the tab with the given connection id: sends a WebSocket Close and drops it from the registry. Errors if no such tab is connected.