Skip to main content

Module live

Module live 

Source
Expand description

The websocket without the socket: subscriptions, the frames sent and received, the connection’s state, what a feed hands back, and a store that keeps live state for an app. Rows the socket sends in the shapes /info answers are the crate::account and crate::markets types; only the socket’s own frames are defined here.

Re-exports§

pub use account::AllDexsState;
pub use account::Cancel;
pub use account::DexState;
pub use account::Funding;
pub use account::HistoricalOrders;
pub use account::LeadingVault;
pub use account::Ledger;
pub use account::Liquidation;
pub use account::OpenOrders;
pub use account::OrderUpdate;
pub use account::PerpDexState;
pub use account::SpotState;
pub use account::TwapEvent;
pub use account::TwapHistory;
pub use account::TwapSliceFills;
pub use account::TwapState;
pub use account::TwapStates;
pub use account::TwapStatus;
pub use account::UserEvent;
pub use account::UserFills;
pub use account::UserFundings;
pub use account::UserState;
pub use account::WebData3;
pub use feed::Event;
pub use feed::FeedError;
pub use frame::Ack;
pub use frame::Answer;
pub use frame::BadFrame;
pub use frame::Frame;
pub use frame::Method;
pub use frame::Refusal;
pub use frame::Reply;
pub use frame::decode;
pub use market::Bbo;
pub use market::Mids;
pub use request::PING;
pub use request::Post;
pub use request::post;
pub use request::subscribe;
pub use request::unsubscribe;
pub use session::Limits;
pub use session::MAX_CONNECTIONS;
pub use session::MAX_INFLIGHT_POSTS;
pub use session::MAX_MESSAGES_PER_MINUTE;
pub use session::MAX_NEW_CONNECTIONS_PER_MINUTE;
pub use session::MAX_SUBSCRIPTIONS;
pub use session::MAX_USERS;
pub use session::Refused;
pub use session::Retry;
pub use session::Session;
pub use session::Tick;
pub use session::Timing;
pub use subscription::BadSubscription;
pub use subscription::Subscription;

Modules§

account
The websocket’s own frames about one account: fills, order updates, events, funding, the ledger, each dex’s clearinghouse, spot balances, TWAPs and webData3. Rows the /info reads answer too (a fill, an order, a clearinghouse) are the crate::account types. Amounts are exact Dec; the venue writes them as strings. Frames that open with history say so in is_snapshot.
feed
What a socket feed hands back and why it refuses, the same for the native and the browser feed (client::native::Feed, client::web::Feed).
frame
Received frames ({"channel":..,"data":..}) read into a type per channel (decode): live’s own frame types, or the crate::account and crate::markets types where the socket sends the shape /info answers. Numbers are exact decimals, never floats. An unknown channel is Frame::Other, kept as written; a frame that does not read is a BadFrame, never a panic.
market
The websocket’s own market frames: the best bid and offer, and one dex’s mids. Books, trades, candles and asset contexts come in the shapes the /info reads answer, the crate::markets types. Every price and size is an exact Dec read from the venue’s string; a number written as a float is refused, never rounded.
request
The frames sent: subscribe, unsubscribe, ping, and a post, which carries an info read or a signed action over the socket instead of over HTTP. Each is one text frame, as JSON.stringify would write it, keys in the docs’ order.
session
One connection’s state with no socket and no clock: the socket’s owner hands in what happened and when, and sends what comes back. Of the venue’s per-IP limits, subscriptions, users and posts in flight are refused here; connections and message rates are the owner’s to keep.
store
Live state kept from the websocket, sans-IO: markets, accounts, and the subscriptions that serve them.
subscription
Every subscription the venue serves (the docs’ list, plus assetCtxs, spotAssetCtxs and userHistoricalOrders), as the object a subscribe or unsubscribe frame carries. webData2 is gone: the venue refuses it.