Skip to main content

NotifySender

Type Alias NotifySender 

Source
pub type NotifySender = UnboundedSender<Value>;
Expand description

Channel used to push a fully-formed JSON-RPC wire object (a Response serialised to Value, or a server-initiated notification) to the connection’s outbound stream, asynchronously, outside the normal request/response cycle.

Why: serde_json::Value (rather than trusty_mcp::Response) is the channel item type because a server-initiated notification ({"jsonrpc":"2.0","method":"session.event","params":{...}}) has no result/error field — it isn’t a Response at all — so the channel must be able to carry either shape. The transport writes whatever arrives verbatim as one NDJSON line. What: mpsc::UnboundedSender<Value>. Unbounded because session events are rare relative to request/response traffic and a bounded channel would require a backpressure policy (drop? block the emitter?) that no current requirement calls for.

Aliased Type§

pub struct NotifySender { /* private fields */ }