Generic request/response protocols.
RequestResponse is a
NetworkBehaviour that implements a generic
request/response protocol or protocol family, whereby each request is
sent over a new substream on a connection.
RequestResponse is generic
over the actual messages being sent, which are defined in terms of a
RequestResponseCodec. Creating a request/response protocol thus amounts
to providing an implementation of this trait which can then be
RequestResponse::new. Further configuration options are
available via the
RequestResponse instance can be used with an entire
protocol family that share the same request and response types.
For that purpose,
RequestResponseCodec::Protocol is typically
instantiated with a sum type.
It is possible to only support inbound or outbound requests for
a particular protocol. This is achieved by instantiating
with protocols using
ProtocolSupport::Outbound. Any subset of protocols of a protocol
family can be configured in this way. Such protocols will not be
advertised during inbound respectively outbound protocol negotiation
on the substreams.
Limit the number of requests peers can send to each other.
The ID of an inbound or outbound request.
A request/response protocol for some message codec.
The configuration for a
A channel for sending a response to an inbound request.
Possible failures occurring in the context of receiving an inbound request and sending a response.
Possible failures occurring in the context of sending an outbound request and receiving the response.
The level of support for a particular protocol.
The events emitted by a
An inbound request or response.
Types serving as protocol names.