|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
Resilient WebSocket connection: DNS -> TCP -> TLS -> WS upgrade -> auth -> subscribe -> Live, with stale/dead detection, exponential backoff reconnects, and make-before-break rollover ahead of the venue's connection lifetime limit (Binance: 24 h). More...
#include "fastmm/net/backoff.hpp"#include "fastmm/net/byte_stream.hpp"#include "fastmm/net/dns.hpp"#include "fastmm/net/reactor.hpp"#include "fastmm/net/source_address.hpp"#include "fastmm/net/tls_stream.hpp"#include "fastmm/net/url.hpp"#include "fastmm/net/ws_client.hpp"#include <algorithm>#include <cstddef>#include <cstdint>#include <functional>#include <memory>#include <optional>#include <span>#include <stdexcept>#include <string>#include <string_view>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | fastmm::net::ConnectionConfig |
| struct | fastmm::net::ConnectionConfig::Tls |
| struct | fastmm::net::ConnectionStats |
| class | fastmm::net::Connection< Stream, Handler > |
Namespaces | |
| namespace | fastmm |
| namespace | fastmm::net |
Concepts | |
| concept | fastmm::net::ConnectionHandler |
Enumerations | |
| enum class | fastmm::net::ConnState : std::uint8_t { fastmm::net::Idle , fastmm::net::Resolving , fastmm::net::Connecting , fastmm::net::TlsHandshake , fastmm::net::WsHandshake , fastmm::net::Authenticating , fastmm::net::Subscribing , fastmm::net::Live , fastmm::net::Stale , fastmm::net::Closing , fastmm::net::Backoff } |
Functions | |
| std::string_view | fastmm::net::to_string (ConnState s) noexcept |
| void | fastmm::net::validate_connection_config (const ConnectionConfig &cfg, Url &url) |
Throws std::invalid_argument on a bad URL; fills url (views into cfg.url). | |
Resilient WebSocket connection: DNS -> TCP -> TLS -> WS upgrade -> auth -> subscribe -> Live, with stale/dead detection, exponential backoff reconnects, and make-before-break rollover ahead of the venue's connection lifetime limit (Binance: 24 h).
Idle -> Resolving -> Connecting -> TlsHandshake -> WsHandshake -> Authenticating -> Subscribing -> Live <-> Stale ; any failure -> Backoff -> Resolving ... close() -> Closing -> Idle (no reconnect)
The handler (static dispatch, see ConnectionHandler) receives state changes and messages. on_connected_send_subscriptions() is where the venue layer writes its subscribe/auth payloads with send_text(); Authenticating/Subscribing pass through synchronously unless the config asks for manual acknowledgement (auth_done()/subscribe_done() from the handler when the venue's ack arrives).
Rollover: when max_lifetime_ms elapses, a second session is opened while the first keeps delivering; once the new session is Live the old one is closed. Both sessions deliver messages during the overlap (market-data consumers must tolerate duplicates, which the book-sync FSM does by sequence number). Sends target the newest session from its on_ws_open onwards so subscriptions land on the right socket.