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

Per-connection resource limits and bind/exposure policy enforced by QtWebSocketServer. More...

#include <qt_websocket_server.hpp>

Public Attributes

std::size_t maxConnections = 0
 Max simultaneous live client connections. 0 = unbounded.
std::size_t maxMessageBytes = ::morph::wire::kMaxEnvelopeBytes
 Per-frame size cap enforced before a message reaches RemoteServer::handle().
std::size_t messagesPerSecond = 0
 Per-connection token-bucket rate limit, in messages per second. 0 = unbounded.
std::chrono::milliseconds handshakeTimeout {0}
 Time allowed for a newly-accepted connection to send its first text frame before it is closed. 0 = disabled.
std::chrono::milliseconds idleTimeout {0}
 Time a connection may go without sending any frame before it is closed. 0 = disabled.
std::chrono::milliseconds sendTimeout {30000}
 Time a frame handed to a connection may stay unwritten before the connection is closed. 0 = disabled.
QHostAddress bindAddress = QHostAddress::LocalHost
 Address listen() binds to. Default QHostAddress::LocalHost.
bool allowPlaintextExposure = false
 Deliberate opt-out of the exposure guard: set true only to knowingly serve plaintext (no TLS) on a non-loopback bindAddress.

Detailed Description

Per-connection resource limits and bind/exposure policy enforced by QtWebSocketServer.

Declared outside QtWebSocketServer so its default member initialisers are fully parsed before any constructor default argument that names Config{} is evaluated (same rationale as morph::qt::QtWebSocketBackendConfig and morph::offline::NetworkMonitorConfig).

Definition at line 36 of file qt_websocket_server.hpp.

Member Data Documentation

◆ maxConnections

std::size_t morph::qt::QtWebSocketServerConfig::maxConnections = 0

Max simultaneous live client connections. 0 = unbounded.

A new connection beyond this count is closed immediately in onNewConnection, before any message exchange and before it is tracked internally.

Definition at line 41 of file qt_websocket_server.hpp.

◆ maxMessageBytes

std::size_t morph::qt::QtWebSocketServerConfig::maxMessageBytes = ::morph::wire::kMaxEnvelopeBytes

Per-frame size cap enforced before a message reaches RemoteServer::handle().

Defaults to morph::wire::kMaxEnvelopeBytes, the wire layer's own bound, so an unconfigured server is capped only there. Set lower to reject oversized frames earlier, before the cost of a pool round-trip and JSON decode.

Definition at line 48 of file qt_websocket_server.hpp.

◆ messagesPerSecond

std::size_t morph::qt::QtWebSocketServerConfig::messagesPerSecond = 0

Per-connection token-bucket rate limit, in messages per second. 0 = unbounded.

The bucket capacity equals messagesPerSecond (an immediate one-second burst is allowed right after connecting), refilling continuously at that rate. A frame that arrives with an empty bucket is refused, not queued: it never reaches RemoteServer, and the sender is answered with an err "rate limited" addressed to that frame's own callId, so a caller's Completion fails rather than waiting forever. The connection stays open — throttling slows a client down, it does not evict one. See docs/spec/core/backend.md.

Definition at line 60 of file qt_websocket_server.hpp.

◆ handshakeTimeout

std::chrono::milliseconds morph::qt::QtWebSocketServerConfig::handshakeTimeout {0}

Time allowed for a newly-accepted connection to send its first text frame before it is closed. 0 = disabled.

QWebSocketServer::newConnection() fires only after the WebSocket (and, in SecureMode, TLS) opening handshake has already completed, so in practice this bounds time-to-first-frame after that point, not the handshake itself — Qt exposes no earlier hook at this layer.

Definition at line 69 of file qt_websocket_server.hpp.

◆ idleTimeout

std::chrono::milliseconds morph::qt::QtWebSocketServerConfig::idleTimeout {0}

Time a connection may go without sending any frame before it is closed. 0 = disabled.

Checked by a periodic housekeeping sweep (roughly once per second), so the actual close can lag the configured value by up to that sweep interval.

Definition at line 76 of file qt_websocket_server.hpp.

◆ sendTimeout

std::chrono::milliseconds morph::qt::QtWebSocketServerConfig::sendTimeout {30000}

Time a frame handed to a connection may stay unwritten before the connection is closed. 0 = disabled.

A peer that stops reading leaves the oldest frame queued on its socket; once that frame is older than this, the socket is aborted, so the connection is retired — its models reclaimed, its events no longer written — instead of holding frames it will never read. The same bound, with the same default, as morph::net::SocketServerConfig::sendTimeout.

Definition at line 86 of file qt_websocket_server.hpp.

◆ bindAddress

QHostAddress morph::qt::QtWebSocketServerConfig::bindAddress = QHostAddress::LocalHost

Address listen() binds to. Default QHostAddress::LocalHost.

Definition at line 89 of file qt_websocket_server.hpp.

◆ allowPlaintextExposure

bool morph::qt::QtWebSocketServerConfig::allowPlaintextExposure = false

Deliberate opt-out of the exposure guard: set true only to knowingly serve plaintext (no TLS) on a non-loopback bindAddress.

Definition at line 93 of file qt_websocket_server.hpp.


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