Module subscribe

Source
Expand description

Logic for associating a subscription-style controller object with a WebSocket stream. A module providing low-level building blocks for controlling a WebSocket stream with an embedded control channel through an external subscription object.

Structs§

MessageStream
A stream of messages that is associated with a Subscription.
Subscription
A subscription associated with a MessageStream that allows for sending and receiving control messages over it.

Enums§

Classification
An enum for the possible classifications of a message.

Traits§

Message
A trait allowing our stream and subscription infrastructure to work with messages.

Functions§

drive
Helper function to drive a Subscription related future to completion. The function makes sure to poll the provided stream, which is assumed to be associated with the Subscription that the future belongs to, so that control messages can be received. Errors reported by the stream (identified via Message::is_error) short circuit and fail the operation immediately.
subscribe
Wrap a stream and an associated control channel into a connected (MessageStream, Subscription) pair, in which the subscription can be used to send and receive control messages over the stream.