Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::common::WebsocketApiConfig Struct Reference

WebSocket API (request / response) configuration. More...

#include <config.hpp>

Public Attributes

std::optional< std::string > api_key
std::optional< std::string > api_secret
std::optional< std::string > url
 wss://… (or ws://…). Set by the product factory when empty.
std::chrono::milliseconds timeout {5000}
 How long to wait for a response.
std::chrono::milliseconds reconnect_delay {5000}
 Delay before reconnecting a connection that dropped.
std::chrono::milliseconds connect_timeout {10000}
 Time allowed to open one connection: DNS, TCP, proxy, TLS and the WebSocket upgrade.
WebsocketMode mode
bool compression = true
 Negotiates permessage-deflate.
std::size_t max_message_size = 64ULL * 1024 * 1024
 Largest message accepted (after decompression). Larger messages close the connection.
std::optional< ProxyConfig > proxy
 HTTP(S) proxy (reached with a CONNECT tunnel) or SOCKS5 proxy.
bool proxy_from_env = false
 When proxy is unset, use the proxy from the environment (proxy_from_environment).
TlsContextHook agent
WebsocketTransportHook transport
std::optional< PrivateKey > private_key
std::optional< std::string > private_key_passphrase
std::optional< TimeUnit > time_unit
TimestampProvider timestamp_provider
 Source of the timestamp of signed requests; empty: the host clock.
bool auto_session_relogon = true
 After a reconnect or renewal, logs the session on again if it was logged on through session.logon, and lets authenticated requests skip apiKey / signature meanwhile.
boost::asio::any_io_executor executor
 Runs the client on this executor instead of a thread of its own, so that many clients can share one event loop.

Detailed Description

WebSocket API (request / response) configuration.

Member Data Documentation

◆ api_key

std::optional<std::string> binance::common::WebsocketApiConfig::api_key

◆ api_secret

std::optional<std::string> binance::common::WebsocketApiConfig::api_secret

◆ url

std::optional<std::string> binance::common::WebsocketApiConfig::url

wss://… (or ws://…). Set by the product factory when empty.

◆ timeout

std::chrono::milliseconds binance::common::WebsocketApiConfig::timeout {5000}

How long to wait for a response.

◆ reconnect_delay

std::chrono::milliseconds binance::common::WebsocketApiConfig::reconnect_delay {5000}

Delay before reconnecting a connection that dropped.

After a failed attempt, a backoff of 1 s doubling up to 60 s, with random jitter, is added to it.

◆ connect_timeout

std::chrono::milliseconds binance::common::WebsocketApiConfig::connect_timeout {10000}

Time allowed to open one connection: DNS, TCP, proxy, TLS and the WebSocket upgrade.

When the host resolves to several addresses, they are tried with staggered attempts (the next address after 250 ms or as soon as the previous one fails, earlier attempts keep running, the first to connect wins) within this one time, not a part of it per address.

◆ mode

WebsocketMode binance::common::WebsocketApiConfig::mode

◆ compression

bool binance::common::WebsocketApiConfig::compression = true

Negotiates permessage-deflate.

◆ max_message_size

std::size_t binance::common::WebsocketApiConfig::max_message_size = 64ULL * 1024 * 1024

Largest message accepted (after decompression). Larger messages close the connection.

◆ proxy

std::optional<ProxyConfig> binance::common::WebsocketApiConfig::proxy

HTTP(S) proxy (reached with a CONNECT tunnel) or SOCKS5 proxy.

◆ proxy_from_env

bool binance::common::WebsocketApiConfig::proxy_from_env = false

When proxy is unset, use the proxy from the environment (proxy_from_environment).

Off by default, as in the other Binance connectors, whose WebSocket connections ignore it.

◆ agent

TlsContextHook binance::common::WebsocketApiConfig::agent

◆ transport

WebsocketTransportHook binance::common::WebsocketApiConfig::transport

◆ private_key

std::optional<PrivateKey> binance::common::WebsocketApiConfig::private_key

◆ private_key_passphrase

std::optional<std::string> binance::common::WebsocketApiConfig::private_key_passphrase

◆ time_unit

std::optional<TimeUnit> binance::common::WebsocketApiConfig::time_unit

◆ timestamp_provider

TimestampProvider binance::common::WebsocketApiConfig::timestamp_provider

Source of the timestamp of signed requests; empty: the host clock.

See TimestampProvider.

◆ auto_session_relogon

bool binance::common::WebsocketApiConfig::auto_session_relogon = true

After a reconnect or renewal, logs the session on again if it was logged on through session.logon, and lets authenticated requests skip apiKey / signature meanwhile.

◆ executor

boost::asio::any_io_executor binance::common::WebsocketApiConfig::executor

Runs the client on this executor instead of a thread of its own, so that many clients can share one event loop.

Keep it running for as long as the client has work, and do not make blocking calls from its threads. Empty: the client starts a dedicated thread.