Expand description
Client for sending IPC commands to external modules via WebSocket. Client for sending IPC commands to external modules via WebSocket.
CommandClient allows control programs to send CommandMessage requests
(e.g., labelit.translate_check) to any external module through the existing
WebSocket connection and poll for responses non-blockingly from process_tick.
§Multi-consumer pattern
The framework passes a &mut CommandClient to the control program each cycle
via TickContext. The framework calls poll()
before process_tick, so incoming responses are already buffered. Each
subsystem sends requests via send() and retrieves
its own responses by transaction ID via
take_response().
ⓘ
fn process_tick(&mut self, ctx: &mut TickContext<Self::Memory>) {
// poll() is already called by the framework before process_tick
// Each subsystem checks for its own responses by transaction_id
self.labelit.tick(ctx.client);
self.other_camera.tick(ctx.client);
// Clean up stale requests
ctx.client.drain_stale(Duration::from_secs(10));
}Structs§
- Command
Client - A non-blocking client for sending IPC commands to external modules.