morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::net::SocketBackendConfig Struct Reference

Reconnect tuning for SocketBackend. More...

#include <socket_backend.hpp>

Public Attributes

bool reconnectEnabled = true
 Whether to attempt automatic reconnect after an unsolicited disconnect.
std::chrono::milliseconds initialReconnectDelay {500}
 Delay before the first reconnect attempt after a disconnect.
std::chrono::milliseconds maxReconnectDelay {30000}
 Upper bound on the exponential backoff between reconnect attempts.
double backoffMultiplier = 2.0
 Multiplier applied to the delay after each failed attempt.
std::chrono::milliseconds connectTimeout {5000}
 Maximum time for the whole connect: name resolution and every resolved address.
std::chrono::milliseconds sendTimeout {30000}
 Bound on writing one chunk (up to 64 KiB) of an outgoing frame.
std::chrono::milliseconds handshakeTimeout {10000}
 Bound on the whole handshake response read that follows a successful TCP connect, from its first byte to the header's end.

Detailed Description

Reconnect tuning for SocketBackend.

Definition at line 42 of file socket_backend.hpp.

Member Data Documentation

◆ reconnectEnabled

bool morph::net::SocketBackendConfig::reconnectEnabled = true

Whether to attempt automatic reconnect after an unsolicited disconnect.

Definition at line 44 of file socket_backend.hpp.

◆ initialReconnectDelay

std::chrono::milliseconds morph::net::SocketBackendConfig::initialReconnectDelay {500}

Delay before the first reconnect attempt after a disconnect.

Definition at line 46 of file socket_backend.hpp.

◆ maxReconnectDelay

std::chrono::milliseconds morph::net::SocketBackendConfig::maxReconnectDelay {30000}

Upper bound on the exponential backoff between reconnect attempts.

Definition at line 48 of file socket_backend.hpp.

◆ backoffMultiplier

double morph::net::SocketBackendConfig::backoffMultiplier = 2.0

Multiplier applied to the delay after each failed attempt.

Definition at line 50 of file socket_backend.hpp.

◆ connectTimeout

std::chrono::milliseconds morph::net::SocketBackendConfig::connectTimeout {5000}

Maximum time for the whole connect: name resolution and every resolved address.

Definition at line 53 of file socket_backend.hpp.

◆ sendTimeout

std::chrono::milliseconds morph::net::SocketBackendConfig::sendTimeout {30000}

Bound on writing one chunk (up to 64 KiB) of an outgoing frame.

A loop timer armed around each chunk's write closes the connection when it runs out, so a peer that stops reading ends in a disconnect (and the usual reconnect) rather than in a queue of unsent frames that grows forever. Generous on purpose: it bounds a write making no progress, not a slow one. Zero disables it.

Definition at line 61 of file socket_backend.hpp.

◆ handshakeTimeout

std::chrono::milliseconds morph::net::SocketBackendConfig::handshakeTimeout {10000}

Bound on the whole handshake response read that follows a successful TCP connect, from its first byte to the header's end.

A peer that accepts the TCP connection and then never completes the WebSocket upgrade — a TCP load balancer connecting lazily to its backend would — is dropped after this long, and counts as a failed connect. Zero disables it.

Definition at line 69 of file socket_backend.hpp.


The documentation for this struct was generated from the following file: