Module websocket_util::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
- A stream of messages that is associated with a
Subscription
. - A subscription associated with a
MessageStream
that allows for sending and receiving control messages over it.
Enums
- An enum for the possible classifications of a message.
Traits
- A trait allowing our stream and subscription infrastructure to work with messages.
Functions
- 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 theSubscription
that the future belongs to, so that control messages can be received. Errors reported by the stream (identified viaMessage::is_error
) short circuit and fail the operation immediately. - 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.