cancellations property

Stream<CancelledNotification> get cancellations
inherited

Every notifications/cancelled the peer sends with a JSON-RPC requestId, in arrival order.

MCPBase registers the connection's only notifications/cancelled handler. A subclass that wants to log a cancellation reason, as both roles are asked to, reads it here instead of registering a handler of its own.

A notification naming a request this side is not answering appears here too, because the ID may belong to a request this side sent. The specification's "ignore" for an unknown ID, an already answered request and a malformed notification means no error response and no change to what goes on the wire, not that the notification is hidden from this side; the one thing dropped here is a requestId that is not a JSON-RPC ID at all.

The request itself keeps running. What a cancellation for a request this side is answering changes is the wire: its response, progress, and other notifications stay off it.

This is a "broadcast" stream, so events are not buffered and previous events will not be re-played when you subscribe.

Implementation

Stream<CancelledNotification> get cancellations => _cancellations.stream;