Expand description
§Brain Bridge
External service relay — WebSocket client that connects Brain to a remote messaging gateway and relays inbound messages through Brain’s signal processing pipeline.
§Protocol
BridgeClientconnects to the configuredurlvia WebSocket.- Each inbound text frame must be a JSON-encoded
BridgeMessage. - A caller-supplied
handlerfunction processes the message and returns aBridgeMessageresponse. - The response is serialised and sent back as a text frame.
- On disconnect, the client reconnects with exponential backoff.
§Usage
let client = BridgeClient::new("ws://gateway.example.com/brain", BridgeConfig::default());
client.connect_and_relay(|msg| async move {
BridgeMessage::reply(&msg, format!("Echo: {}", msg.content))
}).await?;Structs§
- Bridge
Client - WebSocket client that relays messages between Brain and a remote gateway.
- Bridge
Config - Configuration for
BridgeClientreconnection behaviour. - Bridge
Message - A message exchanged between Brain and the remote gateway.