A connection to the MarginTrading WebSocket streams, returned connected by WebsocketStreams::connect().
More...
#include <websocket_streams.hpp>
|
| const common::WebsocketStreamsConfig & | configuration () const noexcept |
| void | disconnect () |
| template<class CompletionToken> |
| auto | async_disconnect (CompletionToken &&token) |
| bool | is_connected () const |
| void | ping_server () |
| | Sends a ping frame on every open connection.
|
| template<class F> |
| common::Subscription | on_event (F &&callback) |
| | Registers a lifecycle callback (common::WebsocketEvent).
|
| common::WebsocketStreamHandle | stream (std::string name, std::optional< common::StreamId > id={}, std::optional< std::string > url_path={}) |
| | Subscribes to a stream by its name, for streams the SDK does not wrap yet, and returns a handle for its callbacks (payloads as boost::json::value).
|
| void | subscribe (const std::vector< std::string > &streams, std::optional< common::StreamId > id={}, const std::optional< std::string > &url_path={}) |
| | Subscribes to raw stream names. Messages are delivered to handles from stream().
|
| void | unsubscribe (const std::vector< std::string > &streams, std::optional< common::StreamId > id={}, const std::optional< std::string > &url_path={}) |
| bool | is_subscribed (const std::string &stream) const |
| template<class CompletionToken> |
| auto | async_wait_subscribed (std::string stream, std::optional< std::string > url_path, CompletionToken &&token) |
| | Completes once the server has acknowledged the subscription of stream; see common::WebsocketStreams::async_wait_subscribed.
|
| void | wait_subscribed (std::string stream, std::optional< std::string > url_path={}, std::optional< std::chrono::milliseconds > timeout={}) |
| common::WebsocketStream< RiskDataStreamEventsResponse > | risk_data (std::string listen_key, std::optional< common::StreamId > id={}) const |
| | Risk data stream of listen_key, as returned by start_user_data_stream() of the REST API.
|
| common::WebsocketStream< TradeDataStreamEventsResponse > | trade_data (std::string listen_key, std::optional< common::StreamId > id={}) const |
| | Trade data stream of listen_key.
|
A connection to the MarginTrading WebSocket streams, returned connected by WebsocketStreams::connect().
Cheap to copy: copies share one common::WebsocketStreams (connection pool and executor), which reconnects, renews its connections and resubscribes until disconnect().
◆ configuration()
◆ disconnect()
| void binance::margin_trading::websocket_streams::WebsocketStreamsConnection::disconnect |
( |
| ) |
|
|
inline |
◆ async_disconnect()
template<class CompletionToken>
| auto binance::margin_trading::websocket_streams::WebsocketStreamsConnection::async_disconnect |
( |
CompletionToken && | token | ) |
|
|
inline |
◆ is_connected()
| bool binance::margin_trading::websocket_streams::WebsocketStreamsConnection::is_connected |
( |
| ) |
const |
|
inlinenodiscard |
◆ ping_server()
| void binance::margin_trading::websocket_streams::WebsocketStreamsConnection::ping_server |
( |
| ) |
|
|
inline |
Sends a ping frame on every open connection.
◆ on_event()
template<class F>
| common::Subscription binance::margin_trading::websocket_streams::WebsocketStreamsConnection::on_event |
( |
F && | callback | ) |
|
|
inline |
◆ stream()
Subscribes to a stream by its name, for streams the SDK does not wrap yet, and returns a handle for its callbacks (payloads as boost::json::value).
Data arriving before the first callback is added is kept for it (up to 1000 messages).
◆ subscribe()
| void binance::margin_trading::websocket_streams::WebsocketStreamsConnection::subscribe |
( |
const std::vector< std::string > & | streams, |
|
|
std::optional< common::StreamId > | id = {}, |
|
|
const std::optional< std::string > & | url_path = {} ) |
|
inline |
Subscribes to raw stream names. Messages are delivered to handles from stream().
◆ unsubscribe()
| void binance::margin_trading::websocket_streams::WebsocketStreamsConnection::unsubscribe |
( |
const std::vector< std::string > & | streams, |
|
|
std::optional< common::StreamId > | id = {}, |
|
|
const std::optional< std::string > & | url_path = {} ) |
|
inline |
◆ is_subscribed()
| bool binance::margin_trading::websocket_streams::WebsocketStreamsConnection::is_subscribed |
( |
const std::string & | stream | ) |
const |
|
inlinenodiscard |
◆ async_wait_subscribed()
template<class CompletionToken>
| auto binance::margin_trading::websocket_streams::WebsocketStreamsConnection::async_wait_subscribed |
( |
std::string | stream, |
|
|
std::optional< std::string > | url_path, |
|
|
CompletionToken && | token ) |
|
inline |
◆ wait_subscribed()
| void binance::margin_trading::websocket_streams::WebsocketStreamsConnection::wait_subscribed |
( |
std::string | stream, |
|
|
std::optional< std::string > | url_path = {}, |
|
|
std::optional< std::chrono::milliseconds > | timeout = {} ) |
|
inline |
◆ risk_data()
Risk data stream of listen_key, as returned by start_user_data_stream() of the REST API.
◆ trade_data()
Trade data stream of listen_key.
◆ WebsocketStreams
| friend class WebsocketStreams |
|
friend |