A simple abstraction layer for multiplexed, streaming communication between two peers. Inpired by/based on packet-stream, but with a few breaking changes.
Over a reliable, ordered, one-to-one, duplex communication channel, the following types of communication are supported:
- message: Send a packet to the peer.
- request: Send a packet to the peer, receive a response packet. Can be cancelled by either participant.
- duplex: Send many packets to the peer, receive many response packets. Both participants can cancel the duplex.
Additionally, implementations may provide restricted versions of duplexes, e.g. unidirectional streams, or unidirectional streams which expect a single response after signalling their end. On the wire, these would simply use duplex packets, only the interface for the programmer is restricted.