pub struct Subscription {
pub name: String,
/* private fields */
}Expand description
Handle to a single live WebSocket subscription. Returned by the
WsClient::subscribe_* calls so callers can cancel an individual
feed without remembering the (topic, conid) pair themselves.
cancel consumes the handle to prevent double-cancel. The handle
is Send + Sync + Clone so it can be stashed in a registry struct
shared between tasks; Clone exists to support that pattern but
double-cancel is harmless beyond a redundant frame on the wire.
Fields§
§name: StringHuman-readable label for telemetry — market_data:265598,
orders, pnl.
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub async fn cancel(self, ws: &mut WsClient) -> Result<()>
pub async fn cancel(self, ws: &mut WsClient) -> Result<()>
Cancel this subscription by sending the matching umd/uor/upl
frame on ws. Consumes the handle. Errors propagate as
Error::WsTransport — but if the socket is already closed
the upstream cancellation is implicit, callers can usually
ignore the error.
Sourcepub fn cancel_payload(&self) -> &str
pub fn cancel_payload(&self) -> &str
Get the cancel payload bytes — exposed for callers that want
to send the cancellation through a different sink (e.g. the
returned half of WsClient::split) rather than the original
WsClient.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more