Trait BridgeHandler
Source pub trait BridgeHandler: 'static {
// Required method
fn on_command(
&self,
name: Option<&str>,
payload: &Value,
) -> Result<Value, String>;
// Provided method
fn on_event(&self, _name: &str, _data: &Value) { ... }
}
Handle a command (request/response). Must return a result.
name is the optional command name from the wire message.
payload is the JSON payload.
Handle a fire-and-forget event from the host.
Default implementation does nothing. Override to process events.