FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
ws_client.hpp File Reference

RFC 6455 WebSocket client over any ByteStream, driven by a Reactor. More...

#include "fastmm/net/byte_stream.hpp"
#include "fastmm/net/http_message.hpp"
#include "fastmm/net/reactor.hpp"
#include "fastmm/net/recv_buffer.hpp"
#include "fastmm/net/wire_buffer.hpp"
#include "fastmm/net/ws_frame.hpp"
#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <string_view>
#include <utility>

Go to the source code of this file.

Classes

struct  fastmm::net::WsClientConfig
 
struct  fastmm::net::WsStats
 
class  fastmm::net::WsClient< Stream, Handler >
 

Namespaces

namespace  fastmm
 
namespace  fastmm::net
 

Concepts

concept  fastmm::net::WsClientHandler
 

Enumerations

enum class  fastmm::net::WsProgress : std::uint8_t { fastmm::net::TcpConnected , fastmm::net::UpgradeSent }
 Milestones before the upgrade completes, so owners can report fine-grained states. More...
 
enum class  fastmm::net::WsState : std::uint8_t {
  fastmm::net::Idle , fastmm::net::Connecting , fastmm::net::Upgrading , fastmm::net::Open ,
  fastmm::net::Closing , fastmm::net::Closed
}
 

Detailed Description

RFC 6455 WebSocket client over any ByteStream, driven by a Reactor.

Lifecycle: start() registers the fd and drives Stream::handshake() (TCP connect, TLS), then sends the HTTP upgrade, verifies Sec-WebSocket-Accept, and switches to framing. Receive path: one read() into the RecvBuffer, then WsMessageAssembler delivers complete messages in place (no copies for unfragmented frames; text payloads keep kPadding bytes behind them for simdjson). Send path: frames are encoded + masked into a WireBuffer and written immediately; leftovers are flushed on EPOLLOUT.

Extensions: none are negotiated. permessage-deflate would be requested in detail::ws_build_upgrade_request and accepted in ws_check_upgrade_response; frames with RSV1 set are rejected until then (see WsMessageAssembler).