FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::net::Connection< Stream, Handler > Class Template Reference

#include <fastmm/net/connection.hpp>

Public Member Functions

 Connection (Reactor &reactor, ConnectionConfig cfg, Handler &handler, TlsContext *tls=nullptr)
 For TLS streams a context is created from cfg.tls unless one is supplied.
 
 ~Connection ()
 
 Connection (const Connection &)=delete
 
Connection & operator= (const Connection &)=delete
 
void connect ()
 Idle -> Resolving. Reconnects happen automatically until close().
 
void close ()
 Explicit shutdown: close frame on the live session, then Idle. No reconnect.
 
bool send_text (std::string_view text) noexcept
 Sends go to the newest session (see rollover note above).
 
void cork () noexcept
 Coalesces the send_text()/send_binary() calls up to uncork() into one write (WsClient::cork).
 
bool uncork () noexcept
 
bool send_binary (std::span< const std::byte > data) noexcept
 
bool send_ping () noexcept
 
void auth_done ()
 Manual acknowledgement hooks (see ConnectionConfig::manual_*).
 
void subscribe_done ()
 
ConnState state () const noexcept
 
bool is_live () const noexcept
 
std::int64_t last_rx_ns () const noexcept
 
const Url & url () const noexcept
 
const ConnectionConfig & config () const noexcept
 
ConnectionStats stats () const noexcept
 Accumulated counters plus the live sessions' running totals.
 

Constructor & Destructor Documentation

◆ Connection() [1/2]

template<ByteStream Stream, ConnectionHandler Handler>
fastmm::net::Connection< Stream, Handler >::Connection ( Reactor &  reactor,
ConnectionConfig  cfg,
Handler &  handler,
TlsContext *  tls = nullptr 
)
inline

For TLS streams a context is created from cfg.tls unless one is supplied.

Sized by the URL: a combined-stream path of many symbols is several kilobytes, and a fixed buffer too small for it left the target empty and the connection never upgrading.

◆ ~Connection()

template<ByteStream Stream, ConnectionHandler Handler>
fastmm::net::Connection< Stream, Handler >::~Connection ( )
inline

◆ Connection() [2/2]

template<ByteStream Stream, ConnectionHandler Handler>
fastmm::net::Connection< Stream, Handler >::Connection ( const Connection< Stream, Handler > &  )
delete

Member Function Documentation

◆ operator=()

template<ByteStream Stream, ConnectionHandler Handler>
Connection & fastmm::net::Connection< Stream, Handler >::operator= ( const Connection< Stream, Handler > &  )
delete

◆ connect()

template<ByteStream Stream, ConnectionHandler Handler>
void fastmm::net::Connection< Stream, Handler >::connect ( )
inline

Idle -> Resolving. Reconnects happen automatically until close().

◆ close()

template<ByteStream Stream, ConnectionHandler Handler>
void fastmm::net::Connection< Stream, Handler >::close ( )
inline

Explicit shutdown: close frame on the live session, then Idle. No reconnect.

◆ send_text()

template<ByteStream Stream, ConnectionHandler Handler>
bool fastmm::net::Connection< Stream, Handler >::send_text ( std::string_view  text)
inlinenoexcept

Sends go to the newest session (see rollover note above).

◆ cork()

template<ByteStream Stream, ConnectionHandler Handler>
void fastmm::net::Connection< Stream, Handler >::cork ( )
inlinenoexcept

Coalesces the send_text()/send_binary() calls up to uncork() into one write (WsClient::cork).

uncork() returns false when the corked session failed meanwhile (true when none was open).

◆ uncork()

template<ByteStream Stream, ConnectionHandler Handler>
bool fastmm::net::Connection< Stream, Handler >::uncork ( )
inlinenoexcept

◆ send_binary()

template<ByteStream Stream, ConnectionHandler Handler>
bool fastmm::net::Connection< Stream, Handler >::send_binary ( std::span< const std::byte >  data)
inlinenoexcept

◆ send_ping()

template<ByteStream Stream, ConnectionHandler Handler>
bool fastmm::net::Connection< Stream, Handler >::send_ping ( )
inlinenoexcept

◆ auth_done()

template<ByteStream Stream, ConnectionHandler Handler>
void fastmm::net::Connection< Stream, Handler >::auth_done ( )
inline

Manual acknowledgement hooks (see ConnectionConfig::manual_*).

◆ subscribe_done()

template<ByteStream Stream, ConnectionHandler Handler>
void fastmm::net::Connection< Stream, Handler >::subscribe_done ( )
inline

◆ state()

template<ByteStream Stream, ConnectionHandler Handler>
ConnState fastmm::net::Connection< Stream, Handler >::state ( ) const
inlinenoexcept

◆ is_live()

template<ByteStream Stream, ConnectionHandler Handler>
bool fastmm::net::Connection< Stream, Handler >::is_live ( ) const
inlinenoexcept

◆ last_rx_ns()

template<ByteStream Stream, ConnectionHandler Handler>
std::int64_t fastmm::net::Connection< Stream, Handler >::last_rx_ns ( ) const
inlinenoexcept

◆ url()

template<ByteStream Stream, ConnectionHandler Handler>
const Url & fastmm::net::Connection< Stream, Handler >::url ( ) const
inlinenoexcept

◆ config()

template<ByteStream Stream, ConnectionHandler Handler>
const ConnectionConfig & fastmm::net::Connection< Stream, Handler >::config ( ) const
inlinenoexcept

◆ stats()

template<ByteStream Stream, ConnectionHandler Handler>
ConnectionStats fastmm::net::Connection< Stream, Handler >::stats ( ) const
inlinenoexcept

Accumulated counters plus the live sessions' running totals.