Preview of main at d0a501a, 2026-11-07

webcpp::beast is a C++20 compatibility facade for Boost.Beast applications. Its purpose is to make those applications usable in WebAssembly through Emscripten or WASIp2/P3, with explicit adaptations where the host has different network facilities. JSPI and Asyncify are Emscripten suspension variants; they are not WASI versions. Native upstream-equivalent types, including the WebSocket stream, are aliases of the actual Boost.Beast types. It preserves Boost.Beast’s messages, buffers and parsers while selecting a transport appropriate to the program’s environment. Native and WASIp2/P3 socket programs use the guest protocol engine. Browser clients use WebSocket and fetch; WASI host HTTP programs use the host’s request and response resources. The application matrix distinguishes direct source compatibility from explicit counterparts, since a browser client and a host HTTP handler do not own a TCP listener.

Tutorial: construct a response

Use the library at libs/beast in the WebCPP superproject, with Boost 1.92 and B2 configured. This first example handles an in-memory request; it opens no connection.

http::response<http::string_body> handle_request(const http::request<http::string_body>& request) {
    http::response<http::string_body> response{http::status::ok, request.version()};
    response.set(http::field::content_type, "text/plain");
    response.body() = "Hello from WebCPP\n";
    response.prepare_payload();
    return response;
}

int main() {
    const http::request<http::string_body> request{http::verb::get, "/hello", 11};
    const auto response = handle_request(request);
    std::cout << response.result_int() << ' ' << response.reason() << '\n';
    std::cout << response[http::field::content_type] << '\n';
    std::cout << response.body();
}

From the superproject root, run:

unset CPATH CPLUS_INCLUDE_PATH C_INCLUDE_PATH
b2 -a libs/beast/example//http_message.output

The expected output is captured from the same example compiled against upstream Beast:

200 OK
text/plain
Hello from WebCPP

The successful finish is a matched .output target. Compiling the executable alone does not check its result.

Exchange a message in the browser

Configure Emscripten and the project’s pinned Chrome. The browser driver serves controlled local peers and the compiled page, runs JSPI and Asyncify, and checks the page’s result. It does not substitute Node for the browser.

b2 -a toolset=emscripten variant=release libs/beast/example/browser//browser

The example resolves the local test peer and records its authority. These operations then exchange a text message through the browser’s WebSocket:

beast::websocket::stream<beast::tcp_stream> socket(io);
beast::get_lowest_layer(socket).connect(addresses, ec);
if (ec) {
    return 1;
}
// These synchronous operations suspend into the browser event loop.
socket.handshake(host, "/echo", ec);
if (ec) {
    return 1;
}
socket.text(true);
socket.write(net::buffer("hello", 5), ec);
if (ec) {
    return 1;
}
beast::flat_buffer incoming;
socket.read(incoming, ec);
if (ec || beast::buffers_to_string(incoming.data()) != "hello") {
    return 1;
}
socket.close(beast::websocket::close_code::normal, ec);
if (ec) {
    return 1;
}

The synchronous interface suspends the C++ stack while the browser handles the operation. Use the Asio suspension configuration supplied by the B2 dependency; blocking the browser thread would prevent the event that completes the wait.

The same example sends an HTTP message through fetch and validates the response:

beast::tcp_stream stream(io);
stream.connect(addresses, ec);
if (ec) {
    return 1;
}
beast::http::request<beast::http::string_body> request{beast::http::verb::post, "/http", 11};
request.set(beast::http::field::host, host);
request.body() = "hello";
request.prepare_payload();
beast::http::write(stream, request, ec);
if (ec) {
    return 1;
}
beast::http::response<beast::http::string_body> response;
incoming.consume(incoming.size());
beast::http::read(stream, incoming, response, ec);
if (ec || response.result_int() != 200 || response.body() != "hello") {
    return 1;
}
stream.socket().shutdown(net::ip::tcp::socket::shutdown_both, ec);
if (ec) {
    return 1;
}

A successful page prints browser tutorial: ok; the driver requires that result for both suspension variants. The controlled peer uses loopback HTTP. Production HTTPS/WSS connections use the browser’s certificate validation and trust store.

Handle a host HTTP request

The WASI example receives an HTTP request from the host and returns a Beast response. The host owns the listener, connection and any HTTPS termination:

// Copyright (c) 2026 WebCpp.org
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include <webcpp/beast/wasi/http.hpp>

namespace http = webcpp::beast::http;

namespace {
/** Application routing and response construction, independent of listener ownership. */
http::response<http::string_body> handle_request(http::request<http::string_body> request) {
    http::response<http::string_body> response{http::status::ok, request.version()};
    response.set(http::field::content_type, "text/plain");
    if (request.target() == "/health") {
        response.body() = "ready\n";
    } else {
        response.body() = request.body();
    }
    response.prepare_payload();
    return response;
}
}  // namespace

// The host owns the listener and any HTTPS trust policy.
WEBCPP_BEAST_WASI_HTTP_EXPORT(handle_request)
b2 -a toolset=clang-wasip2 variant=release libs/beast/example/wasi//http
b2 -a toolset=clang-wasip3 variant=release libs/beast/example/wasi//http

The served test checks the health response and echoed request body against the example’s recorded request transcript. A failed response, timeout or mismatch fails the test. Supplying a guest TCP acceptor is unnecessary for this backend.

How-to: select a dependency and target

B2 dependency Purpose

/webcpp/beast//beast

Portable buffers, HTTP messages, parsers and serializers.

/webcpp/beast//sockets

Native/WASIp2/P3 guest socket algorithms and Asio configuration.

/webcpp/beast//tls

Guest-owned TLS with source-built OpenSSL.

/webcpp/beast//browser

Browser-owned WebSocket, fetch and TLS policy.

/webcpp/beast//wasi-http

WASIp2/P3 host HTTP resources, without guest sockets or OpenSSL.

/webcpp/beast//wasi-streams

Explicit supplied-stream counterparts, including WASI CLI input/output.

Include <webcpp/beast/http/read.hpp> and <webcpp/beast/http/write.hpp> explicitly for byte-stream operations, and <webcpp/beast/tcp_stream.hpp> or <webcpp/beast/websocket.hpp> for the socket types. The convenience header omits these transport headers and <webcpp/beast/ssl.hpp>.

Select the dependency for the transport the application actually uses. A WASI host HTTP handler does not need the guest socket or TLS dependency. Combining backends is explicit, for example a WASIp3 service that accepts host HTTP requests and separately contacts a TCP service.

Build without B2

Use webcpp/beast/ headers and webcpp::beast names, together with the corresponding webcpp::asio types. Native equivalents are actual Boost types. Wasm selects the versioned protocol implementation shipped in the library; the maintainer importer is not a consumer build step, and no replacement Boost include tree is needed. Boost 1.92 remains an explicit dependency for other Boost facilities used by these headers.

Socket and browser programs compile Asio’s target-specific runtime source and use matching thread, exception and suspension settings. Guest TLS adds the explicit OpenSSL and CA provider. Host HTTP instead needs the bindings generated from the selected WASI world. These are different dependency contracts, not automatic substitutions based on an HTTP URL.

The superproject’s tools/test/fixtures/portable-network/CMakeLists.txt builds HTTP and WebSocket consumers from copied source distributions with explicit toolchain and dependency inputs. It uses the same implementation as B2. Application-matrix and measurement results identify their tested revision; historical results do not validate this distribution migration.

b2 -a variant=release exception-handling=on,off libs/beast/test libs/beast/example
b2 -a toolset=clang-wasip2 testing.launcher=tools/boost/asio-wasip2/run.sh exception-handling=on,off libs/beast/test libs/beast/example
b2 -a toolset=clang-wasip3 testing.launcher=tools/boost/asio-wasip3/run.sh exception-handling=on,off libs/beast/test libs/beast/example
b2 -a toolset=emscripten exception-handling=on,off libs/beast/test libs/beast/example

WASIp3 socket tests require the launcher’s loopback networking capabilities. Production hosts should grant only the capabilities their application needs.

Configure error policy

webcpp-beast-unsupported=error is the default; ignore is the alternative intended for documented host-adapter restrictions. It does not make an unavailable transport work. The B2 feature defines exactly one of WEBCPP_BEAST_UNSUPPORTED_ERROR and WEBCPP_BEAST_UNSUPPORTED_IGNORE. Defining both fails compilation.

WEBCPP_BEAST_NO_EXCEPTIONS follows <webcpp/config.hpp> and can also be defined by the application. WEBCPP_NO_EXCEPTIONS applies to all WebCPP libraries. These macros do not change the compiler configuration or remove upstream Boost overloads; use exception-handling=off for a complete build without exception handling. Prefer upstream error-code overloads when recovery is required.

Explanation: separate messages from transport

Boost.Beast’s general headers include stream algorithms that reach Asio sockets. A message-only application does not need those dependencies, even though the Asio port now offers a WASIp2 socket reactor. This facade exposes data headers separately, retaining upstream type identity and parsing behaviour without a guest reactor.

The socket backend executes upstream Beast over the existing Asio port. Host adapters map operations to browser WebSocket/fetch and wasi:http, preserving application-visible messages with documented differences in connection ownership, headers, framing and TLS. A host HTTP handler does not imply a TCP acceptor.

For a server counterpart, keep the application’s HTTP request processing and replace its accept loop with the host handler entry. For a local-stream counterpart, explicitly supply the two stream directions; stdin and stdout do not provide Unix socket names, descriptor passing or peer credentials.

Browser security remains the browser’s: CORS, forbidden request headers, certificate validation, redirects and WebSocket control frames cannot be implemented as arbitrary raw-socket options. Host TLS never uses guest OpenSSL settings. Prefer explicit errors to silently claiming that the host accepted an unavailable setting.

The WASI WebSocket allocator constructor accepts the portable constructor syntax, but upstream Beast still controls its internal stream-state allocation. Native uses the actual Boost stream and its original constructors. Associated completion-handler allocators retain upstream semantics. Data containers use their upstream allocator template parameters.

The shipped Wasm engine corrects an upstream noexcept on the internal variant used by HTTP chunk serialization. With exceptions enabled, failure to allocate a chunk header propagates std::bad_alloc; without exceptions, allocation failure is not recoverable. Native retains the actual Boost 1.92 implementation, which terminates on that particular allocation failure. Error-code overloads do not turn allocation exceptions into protocol error codes. The browser regression injects the failure through the public HTTP serializer and verifies both the exception and the successful serialization controls.

set_server_name configures SNI only. It copies a non-terminated string view into a bounded buffer and rejects empty, overlong or embedded-NUL hostnames. Certificate and hostname verification remain separate TLS settings. Guest OpenSSL settings must never be represented as changing browser or WASI host trust policy.

Feature matrix

Capabilities belong to a backend, not only a compiler target. The runtime record below and the application matrix state which variants were actually exercised. An application counterpart preserves a stated use case; it does not imply every API or transport detail of the original program is available.

Feature Native WASIp2 WASIp3 Emscripten

HTTP message/parser/serializer interfaces

Implemented

Implemented

Implemented

Implemented

Guest HTTP/WebSocket socket engine

Asio sockets

Asio pollable socket backend; see the dated application matrix

Asio socket port

Explicit supplied byte stream only

Browser WebSocket and fetch

Not applicable

Not applicable

Not applicable

JSPI and Asyncify

Guest TLS, identity verification and shutdown

Source-built OpenSSL

Source-built OpenSSL

Source-built OpenSSL

Browser owns TLS

Host HTTP entry/client

Not applicable

wasi:http

wasi:http

fetch client only

Unix socket namespace and peer identity

Operating-system sockets

Unavailable

Unavailable

Unavailable

Explicit supplied-stream counterpart

Borrowed descriptors

CLI input/output; asynchronous WebSocket via pollables

CLI input/output

Caller-supplied channel

Raw TCP HTTP/WebSocket listener

Available

Available with network grants

Available

Unavailable

Host HTTP WebSocket upgrade

Not applicable

Not provided by host adapter

Use guest socket backend

Browser WebSocket client only

Native CPU-parallel threads

Available

Unavailable

Cooperative WASI threads only

Not implied by this backend

Exception and thread variants are reported separately in the verification record. Emscripten data tests run under Node; transport tests run in the pinned Chrome. Cooperative WASIp3 threads are not CPU-parallel threads, and their SDK 34 runtime currently requires exceptions off.

Browser settings and observable differences

This table describes the browser-owned WebSocket and fetch backends. It does not change native or WASIp3 guest socket semantics. ERROR rejects an unsupported setting with operation_not_supported when the dependent operation starts. IGNORE discards that setting; it does not add a missing browser capability or disable browser security. Configuration is part of the browser types’ namespace; translation units using different policies cannot exchange those types silently.

The browser-owned WebSocket’s websocket::request_type uses http::basic_fields<std::pmr::polymorphic_allocator<char>>. Its handshake fields therefore use the stream’s memory resource, including long decorator values. Use that alias, or a generic callable, when declaring a request decorator rather than requiring Boost’s default field allocator. Native and WASIp3 socket streams retain the upstream request type. The explicit guest WebSocket adapter accepts typed WebCPP request and response decorators for client and server handshakes; it converts their fields when calling the upstream protocol implementation.

The test harness configures an ephemeral CA in a disposable full-Chrome profile. The protocol contract peer’s certificate covers localhost and 127.0.0.1; an untrusted profile rejects its WSS connection before the trusted contracts run. Application HTTPS fixtures use a separate localhost-only certificate to prove that a trusted certificate is still rejected for the wrong hostname. These fixture settings belong to the host harness and do not add guest TLS controls.

Setting or operation Outcome Meaning for the application

SNI and host_name_verification matching the URL authority

Accepted

The browser performs its own certificate and hostname validation.

verify_peer, default verification paths, tls_client and sslv23_client

Accepted

The browser chooses its enabled protocol versions and trust store.

Fixed TLS version, verify_none, arbitrary verification callback

Unsupported

The application cannot change browser TLS validation or negotiation.

Client certificate/key, additional roots, verification path or file

Unsupported

Guest certificate material does not configure the browser’s TLS stack.

SNI, verification hostname or handshake Host differing from the URL authority

Unsupported

The browser connects and authenticates the URL authority.

WebSocket decorator’s Sec-WebSocket-Protocol

Accepted

Its values become the browser constructor’s subprotocol list.

Other WebSocket decorator fields, including User-Agent

Unsupported

The browser constructs the handshake headers.

expires_after, expires_at, expires_never, handshake timeout

Accepted

An expired operation returns beast::error::timeout and closes the connection.

Idle timeout without keep-alive pings

Accepted

Visible messages and closure determine activity; incoming ping frames are hidden.

Idle timeout with keep-alive pings; explicit ping and pong

Unsupported

The browser cannot send application-requested control frames.

control_callback

Close notifications only

Ping and pong frames are not exposed by the browser API.

permessage_deflate, auto_fragment, write_buffer_bytes

Ignored under both policies

The browser controls compression and frame boundaries.

Close code 1000 or 3000 through 4999

Accepted

The reason uses Beast’s bounded UTF-8 reason string.

Other close codes, including 1001

Unsupported

Under IGNORE, the adapter closes with 1000 instead.

read_message_max

Enforced

An oversized message reports message_too_big and closes the connection.

queue_limits

Enforced

Queued receives and browser-buffered sends have separate bounds. Exceeding one closes the connection with receive_limit or send_limit.

HTTP Host equal to URL host or host:port

Accepted

The browser generates the corresponding Host field.

HTTP Content-Length and Transfer-Encoding

Message framing accepted

The adapter sends decoded body bytes; fetch chooses wire framing.

HTTP Connection and Keep-Alive

Ignored under both policies

Connection ownership and reuse belong to the browser.

HTTP User-Agent and browser-forbidden request headers

Unsupported

The browser may reject, replace or omit these headers.

HTTP methods or bodies fetch cannot send, including CONNECT

Unsupported

IGNORE cannot make the browser issue a forbidden request.

Redirected HTTP response

Policy dependent

ERROR reports operation_not_supported; IGNORE returns the final response. The redirect has already been followed by fetch when this is reported.

CORS rejection, mixed-content rejection or another fetch failure

browser_errc::fetch_failed

The browser does not reliably expose a more specific cause.

Browser socket facade’s shutdown, close and cancel

Facade lifecycle operations

These stop pending facade work; they do not expose a TCP descriptor.

A successful WebSocket write means the browser accepted the message, not that the peer received it. Partial writes are accumulated into one message, and their bytes count toward the send bound. A cancelled read leaves the next message available to a later read. Destruction aborts pending operations through posted completion and unregisters event callbacks before late events can reach them. Both queue bounds default to 4 MiB. The default maximum WebSocket message is 16 MiB; a smaller receive-queue bound still applies independently. The receive bound charges each retained payload and its message record, including empty messages. Partial reads release that charge only when the complete message is consumed and its storage is released. Container bookkeeping and allocator overhead are additional implementation costs; the bound is not a total heap quota.

The default HTTP path maps messages directly to fetch. Its response body limit defaults to 8 MiB. http::async_read_header and http::read_header accept response messages and complete when metadata is available, before the body is consumed; a subsequent full read consumes the body. The separate http_byte_stream compatibility adapter synthesizes HTTP/1.1 bytes for programs using Beast parsers, buffering the full fetch response before parsing. Fetch has already decoded the response body, so synthetic responses omit original Content-Encoding and Content-Length; responses with a body use chunked framing. HEAD, 204 and 304 responses have no synthetic body or chunk terminator. HEAD parser users retain skip(true). These representation differences do not imply byte-for-byte equality with the original wire response.

Cancellation of host-supplied streams

The WASIp2 WebSocket counterparts use Asio’s pollable-driven CLI adapter and retain asynchronous read/write operations. Their actual client/server exchanges pass with both exception profiles. The P2 Asio supplied-stream lane checks a pending read with open, empty input, timer cancellation, cancellation slots, stream destruction, deferred initiation and handler allocator/executor associations. Other supplied counterparts retain their explicit synchronous partial operations.

Supplied-stream cancellation is checked between host calls and while waiting on supported readiness operations. It cannot preempt a host import that blocks the calling thread. In the tested Wasmtime 50 CLI, WASIp2 stdout can block when its operating-system pipe fills even after check-write grants permission. A paused consumer must resume draining before that import returns and the component can observe cancellation. Keep the consumer draining or select a host/channel with nonblocking write behaviour when a strict cancellation deadline is required.

This is separate from a guest socket’s cancellation semantics. Standard input and output also do not acquire Unix socket addressing or peer credentials merely because they are exposed through file descriptors.

Verification and reproduction

The Application profile evidence contains the current application refresh for the shipped implementation, including separate browser page/worker and single/multi profiles. The dated contract-test record below remains historical evidence; it must not be read as a fresh run of the unsubmitted migration or as performance data.

The shared Release comparison also measures Beast HTTP response parsing inside matched Asio/Cobalt workloads. That in-memory parser workload measures neither transport latency nor TLS throughput. It must not be presented as a network performance comparison.

The local evidence below was collected on macOS ARM64 on 2026-11-02 and 2026-11-03 with Boost 1.92, native Clang 21, wasi-sdk 34, Emscripten 6.0.11 and Wasmtime 50.0.1. Core and guest TLS runs use Release builds. Browser contract runs use Debug, and the standalone upstream oracle compiles with -O0; these are correctness checks, not performance or binary-size measurements. A local pass does not establish Windows or Linux coverage; the remote CI report supplies those independent results.

Suite Profiles exercised What passed

Portable core and socket facade

Native single/multi, exceptions on/off; WASIp2/P3 single, exceptions on/off; Emscripten single, exceptions on/off

Public-header compilation, upstream type identity, binary HTTP bodies, parser limits, error policy, constructor conversion and applicable socket/SNI exchanges.

Guest TLS protocol

Native single/multi, exceptions on/off; WASIp3 single, exceptions on/off; WASIp3 cooperative, exceptions off

Eight scenarios with TLS 1.2 and again with TLS 1.3 in each profile: 112 scenario executions. HTTP and binary WebSocket transfer, normal close, wrong hostname, untrusted CA, cancelled body read, truncated TLS shutdown, cancelled shutdown and handshake timeout.

Browser and Node contract, plus browser tutorial

JSPI/Asyncify, exceptions on/off, ERROR/IGNORE

Real Chrome and Node 26 WebSocket/fetch exchanges, queue and body limits, timeout, cancellation, destruction, allocator alignment, reconnection and response reuse. Direct header reads complete while the server still withholds the body. The allocation counter distinguishes stream, handler and context resources and requires zero escaped global allocations and zero retained blocks after cleanup.

WASI host HTTP and supplied streams

WASIp2/P3 single, exceptions on/off; applicable WASIp3 cooperative tests

Bounded 256 KiB exchanges, request/response trailers, malformed requests, resource cleanup, cancellation and explicit CLI stream counterparts.

WASI host HTTPS

WASIp2/P3 single, exceptions on/off; WASIp3 cooperative, exceptions off

Six application counterparts and the shared sync/async body-and-trailer contract: 35 driver executions containing 125 TLS attempts. Trusted localhost succeeds; unknown CA and trusted wrong hostname fail. The documentation SSL client also proves mutual TLS and rejection without a client identity.

Upstream application inventory

Per-application and per-profile results below

All 53 executable definitions are cross-checked against upstream Jamfiles, CMake definitions and entry points. Source hashes protect the original corpus.

The TLS fixture synchronizes shutdown cancellation with the peer receiving close_notify; it does not rely on an arbitrary sleep or callback ordering. WebSocket close already tears down TLS and TCP, so its test verifies that result without starting a second TLS shutdown. Each protocol scenario has an outer five-second deadline, and the driver also bounds the whole process.

Guest-socket applications compile their Wasm component once with Wasmtime before the execution deadlines start. Compilation has a separate 60-second limit and records its command, duration and exit status. The driver runs only the artifact it produced in its private temporary directory, with matching engine features and epoch interruption enabled. Guest readiness retains its 15-second bound and protocol I/O retains its five-second bound. The WASIp3 driven-test envelope is 90 seconds: the compilation allowance plus the existing 30-second driver bound. Compilation failures report stdout and stderr without starting the guest.

The native WebSocket constructor regression checks same-type move and conversion from a concrete executor to any_io_executor, including deflateSupported=false. The configuration tests include a deliberately failing cross-translation-unit link with different browser policies and a matching-policy success control. An expected compile/link failure is a passing negative test only when B2 reports failed-as-expected and its success control also passes.

The local closure regression on 2026-11-07 additionally exercises the public HTTP serializer in real Chrome with JSPI and Asyncify. With exceptions enabled, a forced chunk-header allocation failure must reach the caller as std::bad_alloc, not abort. A fixed-length body and successful chunked serialization are controls. The builds without exceptions exercise successful serialization only; they do not claim recovery from exhausted memory. The native Boost 1.92 reproduction retains the upstream termination behavior described in Explanation: separate messages from transport.

Reproduce a suite

Configure the project’s pinned SDKs and native Boost 1.92 in a B2 user config. Select Wasmtime 50.0.1 explicitly through PATH. Emscripten 6 requires Python 3.10 or newer; set EMSDK_PYTHON when the system’s default Python is older. The commands assume .local/user-config.jam and run from the superproject root. -a forces compilation and execution; separate build directories preserve logs and outputs across targets.

unset CPATH CPLUS_INCLUDE_PATH C_INCLUDE_PATH
b2 --user-config=.local/user-config.jam -a variant=release \
  exception-handling=on,off threading=single,multi \
  libs/beast/test libs/beast/example libs/beast/test/tls//tls
b2 --user-config=.local/user-config.jam -a toolset=clang-wasip2 \
  variant=release exception-handling=on,off testing.launcher=wasmtime \
  libs/beast/test libs/beast/example libs/beast/test/wasi//http
b2 --user-config=.local/user-config.jam -a toolset=clang-wasip3 \
  variant=release exception-handling=on,off \
  testing.launcher=tools/boost/asio-wasip3/run.sh \
  libs/beast/test libs/beast/example libs/beast/test/tls//tls
b2 --user-config=.local/user-config.jam -a toolset=clang-wasip3 \
  variant=release threading=multi exception-handling=off \
  testing.launcher=tools/boost/asio-wasip3/run.sh \
  libs/beast/test libs/beast/example libs/beast/test/tls//tls
b2 --user-config=.local/user-config.jam \
  libs/beast/test/browser/peer//native_peer-program threading=multi
b2 --user-config=.local/user-config.jam -a toolset=emscripten \
  variant=release exception-handling=on,off \
  libs/beast/test/browser//browser libs/beast/example/browser//browser

The native peer built above is shared by the browser and Node contract suites. Run the Node contracts separately:

b2 --user-config=.local/user-config.jam -a toolset=emscripten \
  exception-handling=on,off libs/beast/test/browser//browser-node

Repeat both contract commands with webcpp-beast-unsupported=ignore to exercise the second policy. The browser lane installs and runs pinned full Chrome. The Node lane executes the same Wasm programs in Node 26, using its WebSocket and fetch APIs; it does not replace the separate browser CORS and mixed-content checks. Host HTTP drivers start Wasmtime with a loopback listener and bounded request transcripts. Production network capabilities remain the embedding application’s responsibility.

HTTPS/WSS fixtures use temporary CAs. The protocol contract peer has a leaf valid for both localhost and 127.0.0.1, preserving its existing loopback request URLs. Its fresh untrusted Chrome profile must reject WSS with an authority error before the trusted contract exchange runs. The application fixture uses a separate leaf valid only for localhost; its trusted profile must reject that certificate when addressed as 127.0.0.1. Full Chrome receives each CA in a disposable profile, and Node receives the contract CA through NODE_EXTRA_CA_CERTS. The system trust store is unchanged, and neither fixture disables certificate verification. Production browser trust remains browser-owned.

The WASI HTTPS fixture embeds exactly Wasmtime 50.0.1 and supplies a private test root through its supported host hook. Rustls performs normal chain and hostname verification. This isolates the CA from the machine and avoids claiming that a guest OpenSSL test establishes host HTTPS behavior. The stock Wasmtime CLI uses its own public roots and does not expose a custom-CA command-line option.

cargo +1.97.1 build --locked \
  --manifest-path libs/beast/test/applications/host-tls/Cargo.toml \
  --target-dir .local/beast-host-tls
export WEBCPP_WASI_TLS_FIXTURE="$PWD/.local/beast-host-tls/debug/webcpp-beast-host-tls-fixture"
b2 --user-config=.local/user-config.jam \
  toolset=clang-wasip2,clang-wasip3 exception-handling=on,off \
  libs/beast/test/applications/host-tls//applications-host-tls

The 53 upstream applications and their adaptations have separate targets. Their matrix records compilation and execution separately, including unavailable programming models rather than selecting an empty fallback program. In particular, stackful Boost.Context coroutines, native threads and asynchronous DNS are not inferred from a successful C++20 coroutine or pre-resolved-address counterpart.

Application profile evidence

All 53 upstream executables remain in every profile. Each cell gives the compile/run result independently. P = measured pass, F = measured failure, B = blocked, U = unavailable, N = no measured result.

A passing counterpart preserves the measured application operations. It does not establish unchanged source, scheduling, DNS, TLS policy or failure semantics. Native oracle comparison covers payloads/status/modes, excluding fixture addresses and elapsed time. Local native measurements use macOS ARM64; other operating systems require their CI runs. Raw results and commands are retained by the drivers.

Profile Configuration

P01

native-original-threads-eh-on

P02

native-port-threads-eh-on

P03

native-port-single-eh-on

P04

native-port-single-eh-off

P05

native-port-threads-eh-off

P06

wasip2-socket-eh-on

P07

wasip2-socket-eh-off

P08

wasip3-socket-single-eh-on

P09

wasip3-socket-single-eh-off

P10

wasip3-socket-cooperative-eh-on

P11

wasip3-socket-cooperative-eh-off

P12

wasip2-host-http-eh-on

P13

wasip2-host-http-eh-off

P14

wasip3-host-http-eh-on

P15

wasip3-host-http-eh-off

P16

wasip2-supplied-stream-eh-on

P17

wasip2-supplied-stream-eh-off

P18

wasip3-supplied-stream-eh-on

P19

wasip3-supplied-stream-eh-off

P20

browser-jspi-single-eh-on-page

P21

browser-jspi-single-eh-on-worker

P22

browser-jspi-single-eh-off-page

P23

browser-jspi-single-eh-off-worker

P24

browser-jspi-multi-eh-on-page

P25

browser-jspi-multi-eh-on-worker

P26

browser-jspi-multi-eh-off-page

P27

browser-jspi-multi-eh-off-worker

P28

browser-asyncify-single-eh-on-page

P29

browser-asyncify-single-eh-on-worker

P30

browser-asyncify-single-eh-off-page

P31

browser-asyncify-single-eh-off-worker

P32

browser-asyncify-multi-eh-on-page

P33

browser-asyncify-multi-eh-on-worker

P34

browser-asyncify-multi-eh-off-page

P35

browser-asyncify-multi-eh-off-worker

Application P01 C/R P02 C/R P03 C/R P04 C/R P05 C/R P06 C/R

advanced-server

P/P

P/P

P/P

P/P

P/P

P/P

advanced-server-flex

P/P

P/P

P/P

P/P

P/P

P/P

advanced-server-flex-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

doc-ssl-client

P/P

P/P

P/P

P/P

P/P

P/P

doc-ssl-server

P/P

P/P

P/P

P/P

P/P

P/P

echo-op

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async-local

P/P

P/P

P/P

P/P

P/P

U/U

http-client-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

P/P

http-client-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

http-client-awaitable-ssl

P/P

P/P

P/P

P/P

P/P

P/P

json_client

P/P

P/P

P/P

P/P

P/P

P/P

http-client-coro

P/P

P/P

P/P

B/B

B/B

B/B

http-client-coro-ssl

P/P

P/P

P/P

B/B

B/B

B/B

http-crawl

P/P

P/P

P/P

P/P

P/P

P/P

http-client-methods

P/P

P/P

P/P

P/P

P/P

P/P

http-client-sync

P/P

P/P

P/P

P/P

P/P

P/P

http-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-server-async

P/P

P/P

P/P

P/P

P/P

P/P

http-server-async-local

P/P

P/P

P/P

P/P

P/P

U/U

http-server-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-server-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

http-server-coro

P/P

P/P

P/P

B/B

B/B

B/B

http-server-coro-ssl

P/P

P/P

P/P

B/B

B/B

B/B

http-server-fast

P/P

P/P

P/P

P/P

P/P

P/P

http-server-flex

P/P

P/P

P/P

P/P

P/P

P/P

http-server-small

P/P

P/P

P/P

P/P

P/P

P/P

http-server-stackless

P/P

P/P

P/P

P/P

P/P

P/P

http-server-stackless-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-server-sync

P/P

P/P

P/P

P/P

P/P

P/P

http-server-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-async

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-async-local

P/P

P/P

P/P

P/P

P/P

U/U

websocket-client-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-coro

P/P

P/P

P/P

B/B

B/B

B/B

websocket-client-coro-ssl

P/P

P/P

P/P

B/B

B/B

B/B

websocket-client-sync

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-async

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-async-local

P/P

P/P

P/P

P/P

P/P

U/U

websocket-server-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

websocket-chat-multi

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-coro

P/P

P/P

P/P

B/B

B/B

B/B

websocket-server-coro-ssl

P/P

P/P

P/P

B/B

B/B

B/B

websocket-server-fast

P/P

P/P

P/P

B/B

B/B

B/B

websocket-server-stackless

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-stackless-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-sync

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

Application P07 C/R P08 C/R P09 C/R P10 C/R P11 C/R P12 C/R

advanced-server

P/P

P/P

P/P

B/B

P/P

P/P

advanced-server-flex

P/P

P/P

P/P

B/B

P/P

P/P

advanced-server-flex-awaitable

P/P

P/P

P/P

B/B

P/P

P/P

doc-ssl-client

P/P

P/P

P/P

B/B

P/P

P/P

doc-ssl-server

P/P

P/P

P/P

B/B

P/P

P/P

echo-op

P/P

P/P

P/P

B/B

P/P

U/U

http-client-async

P/P

P/P

P/P

B/B

P/P

P/P

http-client-async-local

U/U

U/U

U/U

B/B

U/U

P/P

http-client-async-ssl

P/P

P/P

P/P

B/B

P/P

P/P

http-client-async-ssl-system-executor

P/P

P/P

P/P

B/B

P/P

P/P

http-client-awaitable

P/P

P/P

P/P

B/B

P/P

P/P

http-client-awaitable-ssl

P/P

P/P

P/P

B/B

P/P

P/P

json_client

P/P

P/P

P/P

B/B

P/P

P/P

http-client-coro

B/B

B/B

B/B

B/B

B/B

P/P

http-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

P/P

http-crawl

P/P

P/P

P/P

B/B

P/P

P/P

http-client-methods

P/P

P/P

P/P

B/B

P/P

P/P

http-client-sync

P/P

P/P

P/P

B/B

P/P

P/P

http-client-sync-ssl

P/P

P/P

P/P

B/B

P/P

P/P

http-server-async

P/P

P/P

P/P

B/B

P/P

P/P

http-server-async-local

U/U

U/U

U/U

B/B

U/U

P/P

http-server-async-ssl

P/P

P/P

P/P

B/B

P/P

P/P

http-server-awaitable

P/P

P/P

P/P

B/B

P/P

P/P

http-server-coro

B/B

B/B

B/B

B/B

B/B

P/P

http-server-coro-ssl

B/B

B/B

B/B

B/B

B/B

P/P

http-server-fast

P/P

P/P

P/P

B/B

P/P

P/P

http-server-flex

P/P

P/P

P/P

B/B

P/P

P/P

http-server-small

P/P

P/P

P/P

B/B

P/P

P/P

http-server-stackless

P/P

P/P

P/P

B/B

P/P

P/P

http-server-stackless-ssl

P/P

P/P

P/P

B/B

P/P

P/P

http-server-sync

P/P

P/P

P/P

B/B

P/P

P/P

http-server-sync-ssl

P/P

P/P

P/P

B/B

P/P

P/P

websocket-client-async

P/P

P/P

P/P

B/B

P/P

U/U

websocket-client-async-local

U/U

U/U

U/U

B/B

U/U

U/U

websocket-client-async-ssl

P/P

P/P

P/P

B/B

P/P

U/U

websocket-client-async-ssl-system-executor

P/P

P/P

P/P

B/B

P/P

U/U

websocket-client-awaitable

P/P

P/P

P/P

B/B

P/P

U/U

websocket-client-coro

B/B

B/B

B/B

B/B

B/B

U/U

websocket-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

U/U

websocket-client-sync

P/P

P/P

P/P

B/B

P/P

U/U

websocket-client-sync-ssl

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-async

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-async-local

U/U

U/U

U/U

B/B

U/U

U/U

websocket-server-async-ssl

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-awaitable

P/P

P/P

P/P

B/B

P/P

U/U

websocket-chat-multi

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-coro

B/B

B/B

B/B

B/B

B/B

U/U

websocket-server-coro-ssl

B/B

B/B

B/B

B/B

B/B

U/U

websocket-server-fast

B/B

B/B

B/B

B/B

B/B

U/U

websocket-server-stackless

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-stackless-ssl

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-sync

P/P

P/P

P/P

B/B

P/P

U/U

websocket-server-sync-ssl

P/P

P/P

P/P

B/B

P/P

U/U

Application P13 C/R P14 C/R P15 C/R P16 C/R P17 C/R P18 C/R

advanced-server

P/P

P/P

P/P

U/U

U/U

U/U

advanced-server-flex

P/P

P/P

P/P

U/U

U/U

U/U

advanced-server-flex-awaitable

P/P

P/P

P/P

U/U

U/U

U/U

doc-ssl-client

P/P

P/P

P/P

U/U

U/U

U/U

doc-ssl-server

P/P

P/P

P/P

U/U

U/U

U/U

echo-op

U/U

U/U

U/U

U/U

U/U

U/U

http-client-async

P/P

P/P

P/P

U/U

U/U

U/U

http-client-async-local

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-client-async-ssl-system-executor

P/P

P/P

P/P

U/U

U/U

U/U

http-client-awaitable

P/P

P/P

P/P

U/U

U/U

U/U

http-client-awaitable-ssl

P/P

P/P

P/P

U/U

U/U

U/U

json_client

P/P

P/P

P/P

U/U

U/U

U/U

http-client-coro

P/P

P/P

P/P

U/U

U/U

U/U

http-client-coro-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-crawl

P/P

P/P

P/P

U/U

U/U

U/U

http-client-methods

P/P

P/P

P/P

U/U

U/U

U/U

http-client-sync

P/P

P/P

P/P

U/U

U/U

U/U

http-client-sync-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-server-async

P/P

P/P

P/P

U/U

U/U

U/U

http-server-async-local

P/P

P/P

P/P

P/P

P/P

P/P

http-server-async-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-server-awaitable

P/P

P/P

P/P

U/U

U/U

U/U

http-server-coro

P/P

P/P

P/P

U/U

U/U

U/U

http-server-coro-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-server-fast

P/P

P/P

P/P

U/U

U/U

U/U

http-server-flex

P/P

P/P

P/P

U/U

U/U

U/U

http-server-small

P/P

P/P

P/P

U/U

U/U

U/U

http-server-stackless

P/P

P/P

P/P

U/U

U/U

U/U

http-server-stackless-ssl

P/P

P/P

P/P

U/U

U/U

U/U

http-server-sync

P/P

P/P

P/P

U/U

U/U

U/U

http-server-sync-ssl

P/P

P/P

P/P

U/U

U/U

U/U

websocket-client-async

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-async-local

U/U

U/U

U/U

P/P

P/P

P/P

websocket-client-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-async-ssl-system-executor

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-coro

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-sync

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-async

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-async-local

U/U

U/U

U/U

P/P

P/P

P/P

websocket-server-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

websocket-chat-multi

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-fast

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

Application P19 C/R P20 C/R P21 C/R P22 C/R P23 C/R P24 C/R

advanced-server

U/U

U/U

U/U

U/U

U/U

U/U

advanced-server-flex

U/U

U/U

U/U

U/U

U/U

U/U

advanced-server-flex-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

doc-ssl-client

U/U

B/B

B/B

B/B

B/B

B/B

doc-ssl-server

U/U

U/U

U/U

U/U

U/U

U/U

echo-op

U/U

U/U

U/U

U/U

U/U

U/U

http-client-async

U/U

P/P

P/P

P/P

P/P

P/P

http-client-async-local

P/P

U/U

U/U

U/U

U/U

U/U

http-client-async-ssl

U/U

P/P

P/P

P/P

P/P

P/P

http-client-async-ssl-system-executor

U/U

P/P

P/P

P/P

P/P

P/P

http-client-awaitable

U/U

P/P

P/P

P/P

P/P

P/P

http-client-awaitable-ssl

U/U

P/P

P/P

P/P

P/P

P/P

json_client

U/U

P/P

P/P

P/P

P/P

P/P

http-client-coro

U/U

B/B

B/B

B/B

B/B

B/B

http-client-coro-ssl

U/U

B/B

B/B

B/B

B/B

B/B

http-crawl

U/U

P/P

P/P

P/P

P/P

P/P

http-client-methods

U/U

P/P

P/P

P/P

P/P

P/P

http-client-sync

U/U

P/P

P/P

P/P

P/P

P/P

http-client-sync-ssl

U/U

P/P

P/P

P/P

P/P

P/P

http-server-async

U/U

U/U

U/U

U/U

U/U

U/U

http-server-async-local

P/P

U/U

U/U

U/U

U/U

U/U

http-server-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

http-server-coro

U/U

U/U

U/U

U/U

U/U

U/U

http-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-fast

U/U

U/U

U/U

U/U

U/U

U/U

http-server-flex

U/U

U/U

U/U

U/U

U/U

U/U

http-server-small

U/U

U/U

U/U

U/U

U/U

U/U

http-server-stackless

U/U

U/U

U/U

U/U

U/U

U/U

http-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-sync

U/U

U/U

U/U

U/U

U/U

U/U

http-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-async

U/U

P/P

P/P

P/P

P/P

P/P

websocket-client-async-local

P/P

U/U

U/U

U/U

U/U

U/U

websocket-client-async-ssl

U/U

P/P

P/P

P/P

P/P

P/P

websocket-client-async-ssl-system-executor

U/U

P/P

P/P

P/P

P/P

P/P

websocket-client-awaitable

U/U

P/P

P/P

P/P

P/P

P/P

websocket-client-coro

U/U

B/B

B/B

B/B

B/B

B/B

websocket-client-coro-ssl

U/U

B/B

B/B

B/B

B/B

B/B

websocket-client-sync

U/U

P/P

P/P

P/P

P/P

P/P

websocket-client-sync-ssl

U/U

P/P

P/P

P/P

P/P

P/P

websocket-server-async

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-async-local

P/P

U/U

U/U

U/U

U/U

U/U

websocket-server-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

websocket-chat-multi

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-fast

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

Application P25 C/R P26 C/R P27 C/R P28 C/R P29 C/R P30 C/R

advanced-server

U/U

U/U

U/U

U/U

U/U

U/U

advanced-server-flex

U/U

U/U

U/U

U/U

U/U

U/U

advanced-server-flex-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

doc-ssl-client

B/B

B/B

B/B

B/B

B/B

B/B

doc-ssl-server

U/U

U/U

U/U

U/U

U/U

U/U

echo-op

U/U

U/U

U/U

U/U

U/U

U/U

http-client-async

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async-local

U/U

U/U

U/U

U/U

U/U

U/U

http-client-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

P/P

http-client-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

http-client-awaitable-ssl

P/P

P/P

P/P

P/P

P/P

P/P

json_client

P/P

P/P

P/P

P/P

P/P

P/P

http-client-coro

B/B

B/B

B/B

B/B

B/B

B/B

http-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

B/B

http-crawl

P/P

P/P

P/P

P/P

P/P

P/P

http-client-methods

P/P

P/P

P/P

P/P

P/P

P/P

http-client-sync

P/P

P/P

P/P

P/P

P/P

P/P

http-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

http-server-async

U/U

U/U

U/U

U/U

U/U

U/U

http-server-async-local

U/U

U/U

U/U

U/U

U/U

U/U

http-server-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

http-server-coro

U/U

U/U

U/U

U/U

U/U

U/U

http-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-fast

U/U

U/U

U/U

U/U

U/U

U/U

http-server-flex

U/U

U/U

U/U

U/U

U/U

U/U

http-server-small

U/U

U/U

U/U

U/U

U/U

U/U

http-server-stackless

U/U

U/U

U/U

U/U

U/U

U/U

http-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

U/U

http-server-sync

U/U

U/U

U/U

U/U

U/U

U/U

http-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-async

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-async-local

U/U

U/U

U/U

U/U

U/U

U/U

websocket-client-async-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-awaitable

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-coro

B/B

B/B

B/B

B/B

B/B

B/B

websocket-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

B/B

websocket-client-sync

P/P

P/P

P/P

P/P

P/P

P/P

websocket-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

P/P

websocket-server-async

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-async-local

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-async-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-awaitable

U/U

U/U

U/U

U/U

U/U

U/U

websocket-chat-multi

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-fast

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync

U/U

U/U

U/U

U/U

U/U

U/U

websocket-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

U/U

Application P31 C/R P32 C/R P33 C/R P34 C/R P35 C/R

advanced-server

U/U

U/U

U/U

U/U

U/U

advanced-server-flex

U/U

U/U

U/U

U/U

U/U

advanced-server-flex-awaitable

U/U

U/U

U/U

U/U

U/U

doc-ssl-client

B/B

B/B

B/B

B/B

B/B

doc-ssl-server

U/U

U/U

U/U

U/U

U/U

echo-op

U/U

U/U

U/U

U/U

U/U

http-client-async

P/P

P/P

P/P

P/P

P/P

http-client-async-local

U/U

U/U

U/U

U/U

U/U

http-client-async-ssl

P/P

P/P

P/P

P/P

P/P

http-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

http-client-awaitable

P/P

P/P

P/P

P/P

P/P

http-client-awaitable-ssl

P/P

P/P

P/P

P/P

P/P

json_client

P/P

P/P

P/P

P/P

P/P

http-client-coro

B/B

B/B

B/B

B/B

B/B

http-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

http-crawl

P/P

P/P

P/P

P/P

P/P

http-client-methods

P/P

P/P

P/P

P/P

P/P

http-client-sync

P/P

P/P

P/P

P/P

P/P

http-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

http-server-async

U/U

U/U

U/U

U/U

U/U

http-server-async-local

U/U

U/U

U/U

U/U

U/U

http-server-async-ssl

U/U

U/U

U/U

U/U

U/U

http-server-awaitable

U/U

U/U

U/U

U/U

U/U

http-server-coro

U/U

U/U

U/U

U/U

U/U

http-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

http-server-fast

U/U

U/U

U/U

U/U

U/U

http-server-flex

U/U

U/U

U/U

U/U

U/U

http-server-small

U/U

U/U

U/U

U/U

U/U

http-server-stackless

U/U

U/U

U/U

U/U

U/U

http-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

http-server-sync

U/U

U/U

U/U

U/U

U/U

http-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

websocket-client-async

P/P

P/P

P/P

P/P

P/P

websocket-client-async-local

U/U

U/U

U/U

U/U

U/U

websocket-client-async-ssl

P/P

P/P

P/P

P/P

P/P

websocket-client-async-ssl-system-executor

P/P

P/P

P/P

P/P

P/P

websocket-client-awaitable

P/P

P/P

P/P

P/P

P/P

websocket-client-coro

B/B

B/B

B/B

B/B

B/B

websocket-client-coro-ssl

B/B

B/B

B/B

B/B

B/B

websocket-client-sync

P/P

P/P

P/P

P/P

P/P

websocket-client-sync-ssl

P/P

P/P

P/P

P/P

P/P

websocket-server-async

U/U

U/U

U/U

U/U

U/U

websocket-server-async-local

U/U

U/U

U/U

U/U

U/U

websocket-server-async-ssl

U/U

U/U

U/U

U/U

U/U

websocket-server-awaitable

U/U

U/U

U/U

U/U

U/U

websocket-chat-multi

U/U

U/U

U/U

U/U

U/U

websocket-server-coro

U/U

U/U

U/U

U/U

U/U

websocket-server-coro-ssl

U/U

U/U

U/U

U/U

U/U

websocket-server-fast

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless

U/U

U/U

U/U

U/U

U/U

websocket-server-stackless-ssl

U/U

U/U

U/U

U/U

U/U

websocket-server-sync

U/U

U/U

U/U

U/U

U/U

websocket-server-sync-ssl

U/U

U/U

U/U

U/U

U/U

Adaptations and limits

  • WASIp2/P3 socket counterparts use a fixture resolver posting the known local endpoint. DNS worker threads remain unverified. Worker/system executors use an explicit event loop.

  • Host HTTP preserves file handlers or request/body operations. Host listeners, framing and TLS are distinct from guest sockets. Six HTTPS client counterparts run through a configured Wasmtime host with an isolated CA, rejecting unknown issuers and trusted certificates for the wrong hostname. The documentation client additionally measures host-owned mutual TLS and missing-identity rejection. The documentation server measures a host mutual-TLS frontend.

  • The host crawler retains upstream report aggregation and two asynchronous workers over bounded authority/path inputs. Its fixture uses two peers, six paths, four response statuses, and a truncated-response failure followed by continued work. Host HTTP combines transport phases: failures count as Read; separate DNS/connect/write/timer phase counts are unmeasured.

  • Supplied streams replace Unix-domain addressing with caller-provided stdio. P2 WebSocket counterparts retain asynchronous partial operations through Asio pollables; the other supplied counterparts use synchronous partial operations.

  • Browser fetch/WebSocket own DNS, framing and TLS. Guest CA lists, protocol pinning and handshake User-Agent are removed explicitly. HTTPS fixtures install an ephemeral CA in an isolated Chrome profile. A fresh untrusted profile rejects the certificate; the trusted profile rejects its incorrect IP hostname. No certificate-error bypass or system trust-store modification is used.

  • Exception-off counterparts retain error-code paths and successful operations; formerly throwing paths report failure and abort. Stackful Context remains blocked.

  • P2 socket and guest-TLS cells require their own measured application results. Browser listeners and WASI Unix-domain socket addressing remain unavailable. WASIp3 cooperative EH-on lacks the toolchain exception runtime.

Reproduction

python3 libs/beast/test/applications/inventory.py --check
python3 libs/beast/example/applications/tools/prepare.py --clang-format clang-format
b2 libs/beast/test/applications//applications
b2 toolset=clang-wasip3 libs/beast/test/applications/wasip3//applications-p3
b2 toolset=emscripten libs/beast/test/applications/browser//applications-browser
b2 toolset=clang-wasip2 libs/beast/test/applications/host//applications-host
b2 toolset=clang-wasip2 libs/beast/test/applications/host-clients//applications-host-clients
cargo build --locked --manifest-path libs/beast/test/applications/host-tls/Cargo.toml --target-dir .local/host-tls
export PATH="$PWD/.local/host-tls/debug:$PATH"
b2 toolset=clang-wasip2 libs/beast/test/applications/host-tls//applications-host-tls
b2 libs/beast/test/applications/noexcept//applications-noexcept
b2 toolset=clang-wasip3 libs/beast/test/applications/noexcept//applications-single-noexcept
b2 toolset=emscripten libs/beast/test/applications/browser-noexcept//applications-browser
b2 toolset=clang-wasip3 libs/beast/test/applications/streams//applications-streams
b2 toolset=clang-wasip3 libs/beast/test/applications/streams//applications-websocket-streams
b2 libs/beast/test/applications/chat//applications-chat

Configure pinned toolchains with the standard B2 user configuration. Clear CPATH/C_INCLUDE_PATH/CPLUS_INCLUDE_PATH. Runtime peers bind loopback ports, wait for readiness, enforce deadlines, and reap every process.

Guarantees and evidence

  • message_test.cpp checks upstream type identity, embedded-NUL payloads, parser body limits and malformed fields on every declared data target.

  • socket_test.cpp exchanges real HTTP and binary WebSocket payloads, completes both sides of a close handshake, and verifies a stalled peer reaches the stream timeout. Each case has a five-second outer deadline.

  • ssl_test.cpp checks SNI copying and rejection without replacing an existing valid name. It does not claim that an SNI setting authenticates the peer.

  • config_test.cpp checks compiler/global/library exception configuration, both unsupported-operation policies and rejection of conflicting definitions.

  • test/tls/protocol.cpp checks actual TLS HTTP and WebSocket exchanges, authentication failures, transfer cancellation and TLS shutdown outcomes.

  • test/browser/browser_test.cpp runs the browser contracts in Chrome. Its local server controls delayed headers and bodies, redirects, WebSocket closure and CORS.

  • test/applications/inventory.py verifies all 53 pinned upstream executables and their source hashes; application drivers compare explicit local exchanges.

Reference

Macros

Name Description

WEBCPP_BEAST_BACKEND_HEADER

Selects a protocol implementation header for internal use.

WEBCPP_BEAST_HAS_OPENSSL_BACKEND

1 when guest OpenSSL can be linked on the selected target; does not link it.

WEBCPP_BEAST_HAS_SOCKET_BACKEND

1 when the selected Asio backend supplies native or WASI guest sockets.

WEBCPP_BEAST_NO_EXCEPTIONS

Records the facade’s exception policy for host-adapter implementations.

WEBCPP_BEAST_UNSUPPORTED_ERROR

Reports unsupported host operations as errors, the default policy.

WEBCPP_BEAST_UNSUPPORTED_ERROR

Reports unsupported host operations as errors, the default policy.

WEBCPP_BEAST_UNSUPPORTED_IGNORE

Allows documented unsupported settings to be ignored by host adapters.

WEBCPP_BEAST_WASI_HTTP_EXPORT

Exports the P2 host server.

webcpp::beast

Namespaces

Namespace Aliases

Name Description

errc

Upstream generic error conditions.

Types

Name Description

ssl_stream

TLS intent validated before the browser owns the secure connection.

tcp_stream

A browser authority record, with Beast’s connection and deadline interface.

Enums

Name Description

browser_errc

Browser failures without a corresponding Beast or Asio error.

Functions

Name Description

browser_category

Returns the stable browser error category.

make_error_code

Converts a browser failure into its stable error-code representation.

set_server_name

Records the requested TLS server name for authority validation.

Using Declarations

Name Description

basic_flat_buffer

Upstream contiguous dynamic buffer with an application-supplied allocator.

basic_multi_buffer

Upstream segmented dynamic buffer with an application-supplied allocator.

bind_front_handler

Binds leading arguments to a completion handler.

buffers_prefix

Returns a view of the first bytes of a buffer sequence.

buffers_to_string

Copies a buffer sequence to a string.

error

Upstream common stream errors, including timeout.

error_code

The error-code type used by Beast operations.

file_mode

Upstream file-opening modes for explicit file bodies.

flat_buffer

Upstream contiguous dynamic buffer.

flat_static_buffer

Upstream contiguous buffer with fixed capacity.

get_lowest_layer

Finds the innermost layer of a composed stream.

iequals

Compares strings with HTTP’s ASCII case-insensitive rules.

make_printable

Formats a buffer sequence for diagnostic output.

multi_buffer

Upstream segmented dynamic buffer.

ostream

Creates an output stream that appends to a dynamic buffer.

role_type

Client or server role used by protocol options.

static_buffer

Upstream fixed-capacity buffer.

string_view

Upstream non-owning string view.

system_error

Upstream exception type for explicitly throwing application code.

webcpp::beast::browser

Types

Name Description

http_byte_stream

Explicit synthetic HTTP/1.1 adapter for upstream parser and serializer algorithms.

webcpp::beast::browser::http_byte_stream

Explicit synthetic HTTP/1.1 adapter for upstream parser and serializer algorithms.

Synopsis

template</* implementation-defined */ NextLayer>
class http_byte_stream;

Description

Fetch owns real framing. This adapter decodes an outgoing serialized request and exposes a synthetic chunked response. HEAD, 204 and 304 have no body framing. The adapter and its next layer must outlive every outstanding operation.

Type Aliases

Name Description

executor_type

Executor used to schedule stream operations and their completions.

next_layer_type

Type of the layer immediately below this stream.

Member Functions

Name Description

http_byte_stream [constructor]

Attaches a synthetic HTTP byte view to the supplied browser layer.

async_read_some

Reads bytes from the synthetic HTTP response after fetch completes.

async_write_some

Consumes serialized request bytes and starts fetch when the request is complete.

get_executor

Returns the executor used for asynchronous completions.

next_layer

Returns the immediately underlying layer.

read_some

Reads bytes from the synthetic HTTP response after fetch completes.

write_some

Consumes serialized request bytes and starts fetch when the request is complete.

Template Parameters

Name Description

NextLayer

Underlying browser authority or TLS-intent layer.

webcpp::beast::browser::http_byte_stream::executor_type

Executor used to schedule stream operations and their completions.

Synopsis

using executor_type = NextLayer::executor_type;

webcpp::beast::browser::http_byte_stream::next_layer_type

Type of the layer immediately below this stream.

Synopsis

using next_layer_type = NextLayer;

webcpp::beast::browser::http_byte_stream::http_byte_stream

Attaches a synthetic HTTP byte view to the supplied browser layer.

Synopsis

explicit
http_byte_stream(NextLayer& next);

Parameters

Name Description

next

Underlying layer that must outlive this adapter and its operations.

webcpp::beast::browser::http_byte_stream::async_read_some

Reads bytes from the synthetic HTTP response after fetch completes.

Synopsis

template<
    class Buffers,
    class Token>
auto
async_read_some(
    Buffers const& buffers,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::browser::http_byte_stream::async_write_some

Consumes serialized request bytes and starts fetch when the request is complete.

Synopsis

template<
    class Buffers,
    class Token>
auto
async_write_some(
    Buffers const& buffers,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::browser::http_byte_stream::get_executor

Returns the executor used for asynchronous completions.

Synopsis

[[nodiscard]]
executor_type
get_executor() const;

Return Value

The executor associated with the underlying context.

Note

The return value should not be discarded.

webcpp::beast::browser::http_byte_stream::next_layer

Returns the immediately underlying layer.

Synopsis

NextLayer&
next_layer() noexcept;

Return Value

A reference to the underlying stream.

webcpp::beast::browser::http_byte_stream::read_some

Reads bytes from the synthetic HTTP response after fetch completes.

Synopses

Reads bytes from the synthetic HTTP response after fetch completes.

template<class Buffers>
std::size_t
read_some(Buffers const& buffers);

Reads bytes from the synthetic HTTP response after fetch completes.

template<class Buffers>
std::size_t
read_some(
    Buffers const& buffers,
    boost::system::error_code& ec);

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::browser::http_byte_stream::read_some

Reads bytes from the synthetic HTTP response after fetch completes.

Synopsis

template<class Buffers>
std::size_t
read_some(Buffers const& buffers);

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

webcpp::beast::browser::http_byte_stream::read_some

Reads bytes from the synthetic HTTP response after fetch completes.

Synopsis

template<class Buffers>
std::size_t
read_some(
    Buffers const& buffers,
    boost::system::error_code& ec);

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::browser::http_byte_stream::write_some

Consumes serialized request bytes and starts fetch when the request is complete.

Synopses

Consumes serialized request bytes and starts fetch when the request is complete.

template<class Buffers>
std::size_t
write_some(Buffers const& buffers);

Consumes serialized request bytes and starts fetch when the request is complete.

template<class Buffers>
std::size_t
write_some(
    Buffers const& buffers,
    boost::system::error_code& ec);

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::browser::http_byte_stream::write_some

Consumes serialized request bytes and starts fetch when the request is complete.

Synopsis

template<class Buffers>
std::size_t
write_some(Buffers const& buffers);

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

webcpp::beast::browser::http_byte_stream::write_some

Consumes serialized request bytes and starts fetch when the request is complete.

Synopsis

template<class Buffers>
std::size_t
write_some(
    Buffers const& buffers,
    boost::system::error_code& ec);

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http

Functions

Name Description

async_read

Receives the complete decoded fetch response into a Beast message.

async_read_header

Receives response metadata before fetch has consumed its body.

async_write

Submits one complete request to fetch after validating browser restrictions.

read

Receives the complete decoded fetch response into a Beast message.

read_header

read_header overloads

write

Submits one complete request to fetch after validating browser restrictions.

Using Declarations

Name Description

async_read

Upstream HTTP async read operation on a byte stream.

async_read_header

Upstream HTTP async read header operation on a byte stream.

async_read_some

Upstream HTTP async read some operation on a byte stream.

async_write

Upstream HTTP async write operation on a byte stream.

async_write_header

Upstream HTTP async write header operation on a byte stream.

async_write_some

Upstream HTTP async write some operation on a byte stream.

basic_dynamic_body

Upstream body backed by a selected dynamic buffer type.

basic_fields

Upstream HTTP fields with an application-supplied allocator.

basic_string_body

Upstream string body with an application-supplied allocator.

buffer_body

Upstream body that reads or writes caller-owned buffers.

dynamic_body

Upstream dynamically buffered body.

empty_body

Upstream body for messages without a payload.

error

Upstream HTTP parser and serializer errors.

field

Upstream HTTP field names.

fields

Upstream HTTP fields.

file_body

Upstream file-backed message body.

header

Upstream request or response header.

message

Upstream HTTP request or response message.

obsolete_reason

Returns the conventional reason phrase for a status code.

parser

Upstream incremental message parser.

read

Upstream HTTP read operation on a byte stream.

read_header

Upstream HTTP read header operation on a byte stream.

read_some

Upstream HTTP read some operation on a byte stream.

request

Upstream HTTP request.

request_header

Upstream HTTP request header.

request_parser

Upstream incremental request parser.

request_serializer

Upstream incremental request serializer.

response

Upstream HTTP response.

response_header

Upstream HTTP response header.

response_parser

Upstream incremental response parser.

response_serializer

Upstream incremental response serializer.

serializer

Upstream incremental message serializer.

status

Upstream HTTP status codes.

string_body

Upstream string message body.

string_to_verb

Parses a method name while preserving upstream method semantics.

verb

Upstream HTTP methods.

write

Upstream HTTP write operation on a byte stream.

write_header

Upstream HTTP write header operation on a byte stream.

write_some

Upstream HTTP write some operation on a byte stream.

webcpp::beast::http::async_read

Receives the complete decoded fetch response into a Beast message.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator,
    class Token>
auto
async_read(
    Stream& stream,
    Buffer&,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Fetch decoding precedes message delivery, and wire framing headers are normalized. The authority record response_body_limit bounds the decoded body before allocation.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Buffer

Dynamic buffer type retained for Beast call compatibility.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

response

Destination message, kept alive until asynchronous completion when applicable.

token

Completion token controlling handler construction and the return type.

webcpp::beast::http::async_read_header

Receives response metadata before fetch has consumed its body.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator,
    class Token>
auto
async_read_header(
    Stream& stream,
    Buffer&,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    Token&& token);

Description

The next complete read consumes the retained response body; a metadata read leaves it untouched. The buffer parameter is retained for Beast call compatibility and receives no wire bytes.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Stream

Browser authority or TLS-intent stream.

Buffer

Dynamic buffer type accepted for call compatibility.

Body

Beast body model of the destination response.

Allocator

Allocator of the destination fields.

Token

Completion token for void(error_code, std::size_t).

Parameters

Name Description

stream

Stream with an outstanding fetch request.

response

Destination for status and exposed fields; kept alive until completion.

token

Completion token determining the operation result type.

webcpp::beast::http::async_write

Submits one complete request to fetch after validating browser restrictions.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Body,
    class Allocator,
    class Token>
auto
async_write(
    Stream& stream,
    webcpp::beast_backend::http::request<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& request,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

request

Complete request, kept alive until asynchronous completion when applicable.

token

Completion token controlling handler construction and the return type.

webcpp::beast::http::read

Receives the complete decoded fetch response into a Beast message.

Synopses

Receives the complete decoded fetch response into a Beast message.

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response);

Receives the complete decoded fetch response into a Beast message.

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    boost::system::error_code& ec);

Return Value

The number of decoded body bytes delivered.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Buffer

Dynamic buffer type retained for Beast call compatibility.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

buffer

Compatibility buffer; direct fetch reads do not consume or append wire bytes.

response

Destination message, kept alive until asynchronous completion when applicable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::read

Receives the complete decoded fetch response into a Beast message.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response);

Description

Fetch decoding precedes message delivery, and wire framing headers are normalized. The authority record response_body_limit bounds the decoded body before allocation.

Return Value

The number of decoded body bytes delivered.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Buffer

Dynamic buffer type retained for Beast call compatibility.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

buffer

Compatibility buffer; direct fetch reads do not consume or append wire bytes.

response

Destination message, kept alive until asynchronous completion when applicable.

webcpp::beast::http::read

Receives the complete decoded fetch response into a Beast message.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    boost::system::error_code& ec);

Description

Fetch decoding precedes message delivery, and wire framing headers are normalized. The authority record response_body_limit bounds the decoded body before allocation.

Return Value

The number of decoded body bytes delivered.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Buffer

Dynamic buffer type retained for Beast call compatibility.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

buffer

Compatibility buffer; direct fetch reads do not consume or append wire bytes.

response

Destination message, kept alive until asynchronous completion when applicable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::read_header

read_header overloads

Synopses

Suspends until response metadata is available and throws on failure.

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read_header(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response);

Suspends the main stack until fetch exposes response metadata.

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read_header(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    boost::system::error_code& ec);

Return Value

The logical HTTP status-line and field byte count, excluding the body.

Template Parameters

Name Description

Stream

Browser authority or TLS-intent stream.

Buffer

Dynamic buffer type accepted for call compatibility.

Body

Beast body model of the destination response.

Allocator

Allocator of the destination fields.

Parameters

Name Description

stream

Stream with an outstanding fetch request.

buffer

Compatibility buffer, whose contents are unchanged.

response

Destination for response status and exposed fields.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::read_header

Suspends until response metadata is available and throws on failure.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read_header(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response);

Return Value

The logical HTTP status-line and field byte count, excluding the body.

Template Parameters

Name Description

Stream

Browser authority or TLS-intent stream.

Buffer

Dynamic buffer type accepted for call compatibility.

Body

Beast body model of the destination response.

Allocator

Allocator of the destination fields.

Parameters

Name Description

stream

Stream with an outstanding fetch request.

buffer

Compatibility buffer, whose contents are unchanged.

response

Destination for response status and exposed fields.

webcpp::beast::http::read_header

Suspends the main stack until fetch exposes response metadata.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Buffer,
    class Body,
    class Allocator>
std::size_t
read_header(
    Stream& stream,
    Buffer& buffer,
    webcpp::beast_backend::http::response<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& response,
    boost::system::error_code& ec);

Description

The complete body remains available to a later read, and executing handlers cannot reenter this synchronous facade.

Return Value

The logical HTTP status-line and field byte count, excluding the body.

Template Parameters

Name Description

Stream

Browser authority or TLS-intent stream.

Buffer

Dynamic buffer type accepted for call compatibility.

Body

Beast body model of the destination response.

Allocator

Allocator of the destination fields.

Parameters

Name Description

stream

Stream with an outstanding fetch request.

buffer

Compatibility buffer, whose contents are unchanged.

response

Destination for response status and exposed fields.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::write

Submits one complete request to fetch after validating browser restrictions.

Synopses

Submits one complete request to fetch after validating browser restrictions.

template<
    /* implementation-defined */ Stream,
    class Body,
    class Allocator>
std::size_t
write(
    Stream& stream,
    webcpp::beast_backend::http::request<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& request);

Submits one complete request to fetch after validating browser restrictions.

template<
    /* implementation-defined */ Stream,
    class Body,
    class Allocator>
std::size_t
write(
    Stream& stream,
    webcpp::beast_backend::http::request<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& request,
    boost::system::error_code& ec);

Return Value

The accepted body and synthetic header byte count.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

request

Complete request, kept alive until asynchronous completion when applicable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::write

Submits one complete request to fetch after validating browser restrictions.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Body,
    class Allocator>
std::size_t
write(
    Stream& stream,
    webcpp::beast_backend::http::request<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& request);

Return Value

The accepted body and synthetic header byte count.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

request

Complete request, kept alive until asynchronous completion when applicable.

webcpp::beast::http::write

Submits one complete request to fetch after validating browser restrictions.

Synopsis

template<
    /* implementation-defined */ Stream,
    class Body,
    class Allocator>
std::size_t
write(
    Stream& stream,
    webcpp::beast_backend::http::request<Body, webcpp::beast_backend::http::basic_fields<Allocator>>& request,
    boost::system::error_code& ec);

Return Value

The accepted body and synthetic header byte count.

Template Parameters

Name Description

Stream

Browser authority record or TLS-intent stream.

Body

Beast body model used to encode or receive the message body.

Allocator

Allocator used by the HTTP message fields.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

request

Complete request, kept alive until asynchronous completion when applicable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::http::async_read

Upstream HTTP async read operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_read;

webcpp::beast::http::async_read_header

Upstream HTTP async read header operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_read_header;

webcpp::beast::http::async_read_some

Upstream HTTP async read some operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_read_some;

webcpp::beast::http::async_write

Upstream HTTP async write operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_write;

webcpp::beast::http::async_write_header

Upstream HTTP async write header operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_write_header;

webcpp::beast::http::async_write_some

Upstream HTTP async write some operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::async_write_some;

webcpp::beast::http::basic_dynamic_body

Upstream body backed by a selected dynamic buffer type.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::basic_dynamic_body;

webcpp::beast::http::basic_fields

Upstream HTTP fields with an application-supplied allocator.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::basic_fields;

webcpp::beast::http::basic_string_body

Upstream string body with an application-supplied allocator.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::basic_string_body;

webcpp::beast::http::buffer_body

Upstream body that reads or writes caller-owned buffers.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::buffer_body;

webcpp::beast::http::dynamic_body

Upstream dynamically buffered body.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::dynamic_body;

webcpp::beast::http::empty_body

Upstream body for messages without a payload.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::empty_body;

webcpp::beast::http::error

Upstream HTTP parser and serializer errors.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::error;

webcpp::beast::http::field

Upstream HTTP field names.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::field;

webcpp::beast::http::fields

Upstream HTTP fields.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::fields;

webcpp::beast::http::file_body

Upstream file-backed message body.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::file_body;

webcpp::beast::http::header

Upstream request or response header.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::header;

webcpp::beast::http::message

Upstream HTTP request or response message.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::message;

webcpp::beast::http::obsolete_reason

Returns the conventional reason phrase for a status code.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::obsolete_reason;

webcpp::beast::http::parser

Upstream incremental message parser.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::parser;

webcpp::beast::http::read

Upstream HTTP read operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::read;

webcpp::beast::http::read_header

Upstream HTTP read header operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::read_header;

webcpp::beast::http::read_some

Upstream HTTP read some operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::read_some;

webcpp::beast::http::request

Upstream HTTP request.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::request;

webcpp::beast::http::request_header

Upstream HTTP request header.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::request_header;

webcpp::beast::http::request_parser

Upstream incremental request parser.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::request_parser;

webcpp::beast::http::request_serializer

Upstream incremental request serializer.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::request_serializer;

webcpp::beast::http::response

Upstream HTTP response.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::response;

webcpp::beast::http::response_header

Upstream HTTP response header.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::response_header;

webcpp::beast::http::response_parser

Upstream incremental response parser.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::response_parser;

webcpp::beast::http::response_serializer

Upstream incremental response serializer.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::response_serializer;

webcpp::beast::http::serializer

Upstream incremental message serializer.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::serializer;

webcpp::beast::http::status

Upstream HTTP status codes.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::status;

webcpp::beast::http::string_body

Upstream string message body.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::string_body;

webcpp::beast::http::string_to_verb

Parses a method name while preserving upstream method semantics.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::string_to_verb;

webcpp::beast::http::verb

Upstream HTTP methods.

Synopsis

Declared in <webcpp/beast/http.hpp>

using webcpp::beast_backend::http::verb;

webcpp::beast::http::write

Upstream HTTP write operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::write;

webcpp::beast::http::write_header

Upstream HTTP write header operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::write_header;

webcpp::beast::http::write_some

Upstream HTTP write some operation on a byte stream.

Synopsis

using webcpp::beast_backend::http::write_some;

webcpp::beast::wasi

Types

Name Description

client

A host HTTP client.

http_context

Drives bounded host readiness operations without a socket reactor or worker thread.

stdio_stream

stdin/stdout or a supplied descriptor pair, borrowed exclusively for this object’s lifetime.

stream_control

Cancellation and a deadline for a supplied channel; no background worker is created.

supplied_stream

A borrowed pair of nonblocking host channels.

Functions

Name Description

async_perform

Asynchronously performs a host client exchange with bounded readiness steps.

async_receive

Asynchronously reads a complete host request with bounded readiness steps.

async_send

Asynchronously commits and writes one host response with bounded readiness steps.

read

Parses one message and retains overread in the caller’s buffer.

receive

Reads a complete host request into the caller’s allocator.

send

Sends one response, returning logical body payload bytes.

write

Serializes one message and returns actual channel bytes.

Using Declarations

Name Description

body_reader

Explicit streaming host input, independent of a socket.

body_writer

Explicit streaming host output, independent of a socket.

transfer_options

Transfer limits and cancellation shared with the host HTTP resources.

webcpp::beast::wasi::client

A host HTTP client.

Synopsis

class client;

Description

The host owns DNS, connections and HTTPS trust.

Member Functions

Name Description

client [constructor]

Borrows connection metadata, which must outlive this client.

authority

Returns the borrowed request authority.

perform

Performs a suspending exchange, preserving the caller’s Beast body and field allocators.

scheme

Returns the borrowed request scheme.

webcpp::beast::wasi::client::client

Borrows connection metadata, which must outlive this client.

Synopsis

client(
    std::string_view scheme,
    std::string_view authority);

Parameters

Name Description

scheme

HTTP or HTTPS.

authority

Host and optional port.

webcpp::beast::wasi::client::authority

Returns the borrowed request authority.

Synopsis

[[nodiscard]]
std::string_view
authority() const noexcept;

Return Value

Host and optional port, as supplied at construction.

Note

The return value should not be discarded.

webcpp::beast::wasi::client::perform

Performs a suspending exchange, preserving the caller’s Beast body and field allocators.

Synopsis

template<
    class RequestBody,
    class RequestFields,
    class ResponseBody,
    class ResponseFields,
    class Trailers = webcpp::beast_backend::http::fields>
std::size_t
perform(
    http::request<RequestBody, RequestFields>& request,
    http::response<ResponseBody, ResponseFields>& response,
    boost::system::error_code& error,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers* response_trailers = nullptr,
    Trailers const* request_trailers = nullptr);

Description

The request and response may use any synchronous Beast BodyReader/BodyWriter. Returned bytes count decoded response payload only. Transfer encoding and connection ownership remain host capabilities; forbidden fields produce a visible error.

Return Value

The number of received response payload bytes.

Template Parameters

Name Description

RequestBody

Outgoing Beast body type.

RequestFields

Outgoing Beast fields type.

ResponseBody

Incoming Beast body type.

ResponseFields

Incoming Beast fields type.

Trailers

Trailer fields type.

Parameters

Name Description

request

Outgoing application message.

response

Initially empty incoming message.

error

Receives any transfer failure.

options

Body limit, cancellation and deadline.

response_trailers

Optional received trailers.

request_trailers

Optional outgoing trailers.

webcpp::beast::wasi::client::scheme

Returns the borrowed request scheme.

Synopsis

[[nodiscard]]
std::string_view
scheme() const noexcept;

Return Value

HTTP or HTTPS, as supplied at construction.

Note

The return value should not be discarded.

webcpp::beast::wasi::http_context

Drives bounded host readiness operations without a socket reactor or worker thread.

Synopsis

class http_context;

Description

poll performs one bounded scan and never waits for data. run yields the current component task between scans. Callers keep messages and resources alive until their completion handler runs. Posted completion storage is released before invoking the handler, so its associated allocator resource may be released there. Destroying the context abandons pending handlers and cancels their host resource operations before releasing state.

Types

Name Description

executor_type

An executor that queues work on its owning host context.

Member Functions

Name Description

http_context [constructor]

Constructors

~http_context [destructor]

Cancels and releases pending operations without invoking abandoned handlers.

operator= [deleted]

Forbids duplicated ownership of pending operations.

enqueue

Takes ownership of an intrusive readiness operation.

get_executor

Returns the executor of this context.

poll

Polls each initially queued operation once without waiting for readiness.

run

Runs until no owned operation or associated work remains.

webcpp::beast::wasi::http_context::executor_type

An executor that queues work on its owning host context.

Synopsis

class executor_type;

Member Functions

Name Description

executor_type [constructor]

Refers to one host context.

context

Returns the owning context.

defer

Queues a continuation without inline invocation.

dispatch

Queues dispatch work without inline invocation.

on_work_finished

Releases externally associated outstanding work.

on_work_started

Retains externally associated outstanding work.

post

Queues a function using the supplied allocator.

operator==

Compares context identity.

webcpp::beast::wasi::http_context::executor_type::executor_type

Refers to one host context.

Synopsis

explicit
executor_type(http_context& context) noexcept;

Parameters

Name Description

context

Owning execution context.

webcpp::beast::wasi::http_context::executor_type::context

Returns the owning context.

Synopsis

[[nodiscard]]
http_context&
context() const noexcept;

Return Value

The owning host context.

Note

The return value should not be discarded.

webcpp::beast::wasi::http_context::executor_type::defer

Queues a continuation without inline invocation.

Synopsis

template<
    class Function,
    class Allocator>
void
defer(
    Function&& function,
    Allocator const& allocator) const;

Template Parameters

Name Description

Function

Nullary callable.

Allocator

State allocator.

Parameters

Name Description

function

Work to execute.

allocator

Allocator for the queue node.

webcpp::beast::wasi::http_context::executor_type::dispatch

Queues dispatch work without inline invocation.

Synopsis

template<
    class Function,
    class Allocator>
void
dispatch(
    Function&& function,
    Allocator const& allocator) const;

Template Parameters

Name Description

Function

Nullary callable.

Allocator

State allocator.

Parameters

Name Description

function

Work to execute.

allocator

Allocator for the queue node.

webcpp::beast::wasi::http_context::executor_type::on_work_finished

Releases externally associated outstanding work.

Synopsis

void
on_work_finished() const noexcept;

webcpp::beast::wasi::http_context::executor_type::on_work_started

Retains externally associated outstanding work.

Synopsis

void
on_work_started() const noexcept;

webcpp::beast::wasi::http_context::executor_type::post

Queues a function using the supplied allocator.

Synopsis

template<
    class Function,
    class Allocator>
void
post(
    Function&& function,
    Allocator const& allocator) const;

Template Parameters

Name Description

Function

Nullary callable.

Allocator

State allocator.

Parameters

Name Description

function

Work to execute on a subsequent poll.

allocator

Allocator used for the queue node.

webcpp::beast::wasi::http_context::executor_type::operator==

Compares context identity.

Synopsis

bool
operator==(executor_type const& other) const noexcept;

Return Value

Whether the executors share a context.

Parameters

Name Description

other

Executor to compare.

webcpp::beast::wasi::http_context::http_context

Constructors

Synopses

Constructs an empty host context.

constexpr
http_context() = default;

Forbids duplicated ownership of pending operations.

http_context(http_context const&) = delete;

webcpp::beast::wasi::http_context::http_context

Constructs an empty host context.

Synopsis

constexpr
http_context() = default;

webcpp::beast::wasi::http_context::http_context

Forbids duplicated ownership of pending operations.

Synopsis

http_context(http_context const&) = delete;

webcpp::beast::wasi::http_context::~http_context

Cancels and releases pending operations without invoking abandoned handlers.

Synopsis

~http_context();

webcpp::beast::wasi::http_context::operator=

Forbids duplicated ownership of pending operations.

Synopsis

http_context&
operator=(http_context const&) = delete;

webcpp::beast::wasi::http_context::enqueue

Takes ownership of an intrusive readiness operation.

Synopsis

void
enqueue(/* implementation-defined */* value);

Parameters

Name Description

value

Allocator-owned operation, with its matching destroy function.

webcpp::beast::wasi::http_context::get_executor

Returns the executor of this context.

Synopsis

executor_type
get_executor() noexcept;

Return Value

A borrowing executor.

webcpp::beast::wasi::http_context::poll

Polls each initially queued operation once without waiting for readiness.

Synopsis

std::size_t
poll();

Return Value

The number of completed operations or posted functions.

webcpp::beast::wasi::http_context::run

Runs until no owned operation or associated work remains.

Synopsis

std::size_t
run();

Return Value

The number of completed operations or posted functions.

webcpp::beast::wasi::stdio_stream

stdin/stdout or a supplied descriptor pair, borrowed exclusively for this object’s lifetime.

Synopsis

class stdio_stream;

Description

Descriptors are set nonblocking and restored on destruction, never closed. stdout is protocol-only; diagnostics belong on stderr. Readiness and cancellation are checked every ten milliseconds while blocked. This does not provide Unix-domain socket semantics.

Member Functions

Name Description

stdio_stream [constructor]

Constructors

~stdio_stream [destructor]

Restores borrowed descriptor flags and releases host resources.

operator= [deleted]

Forbids duplicated channel ownership.

control

Sets transfer cancellation and deadline.

read_some

Reads a partial input span.

write_some

Writes a partial output span.

webcpp::beast::wasi::stdio_stream::stdio_stream

Constructors

Synopses

Forbids duplicated channel ownership.

stdio_stream(stdio_stream const&) = delete;

Acquires standard streams or borrows an exclusive descriptor pair.

explicit
stdio_stream(
    int input_descriptor = STDIN_FILENO,
    int output_descriptor = STDOUT_FILENO,
    stream_control control = {});

Parameters

Name Description

input_descriptor

Input descriptor, normally stdin.

output_descriptor

Output descriptor, normally stdout.

control

Initial cancellation and deadline.

webcpp::beast::wasi::stdio_stream::stdio_stream

Forbids duplicated channel ownership.

Synopsis

stdio_stream(stdio_stream const&) = delete;

webcpp::beast::wasi::stdio_stream::stdio_stream

Acquires standard streams or borrows an exclusive descriptor pair.

Synopsis

explicit
stdio_stream(
    int input_descriptor = STDIN_FILENO,
    int output_descriptor = STDOUT_FILENO,
    stream_control control = {});

Parameters

Name Description

input_descriptor

Input descriptor, normally stdin.

output_descriptor

Output descriptor, normally stdout.

control

Initial cancellation and deadline.

webcpp::beast::wasi::stdio_stream::~stdio_stream

Restores borrowed descriptor flags and releases host resources.

Synopsis

~stdio_stream();

webcpp::beast::wasi::stdio_stream::operator=

Forbids duplicated channel ownership.

Synopsis

stdio_stream&
operator=(stdio_stream const&) = delete;

webcpp::beast::wasi::stdio_stream::control

Sets transfer cancellation and deadline.

Synopsis

void
control(stream_control value);

Parameters

Name Description

value

Settings for subsequent operations.

webcpp::beast::wasi::stdio_stream::read_some

Reads a partial input span.

Synopsis

template<class Buffers>
std::size_t
read_some(
    Buffers const& buffers,
    boost::system::error_code& error);

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

Buffers

Asio mutable buffer sequence.

Parameters

Name Description

buffers

Destination buffers.

error

Receives any transfer failure.

webcpp::beast::wasi::stdio_stream::write_some

Writes a partial output span.

Synopsis

template<class Buffers>
std::size_t
write_some(
    Buffers const& buffers,
    boost::system::error_code& error);

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

Buffers

Asio constant buffer sequence.

Parameters

Name Description

buffers

Source buffers.

error

Receives any transfer failure.

webcpp::beast::wasi::stream_control

Cancellation and a deadline for a supplied channel; no background worker is created.

Synopsis

struct stream_control;

Member Functions

Name Description

check

Reports cancellation or expiry.

Data Members

Name Description

cancellation_context

Opaque cancellation predicate state.

cancelled

Optional cancellation predicate.

deadline

Absolute deadline, or the maximum time point for none.

webcpp::beast::wasi::stream_control::check

Reports cancellation or expiry.

Synopsis

[[nodiscard]]
boost::system::error_code
check() const;

Return Value

An empty error value on success, otherwise the failure.

Note

The return value should not be discarded.

webcpp::beast::wasi::stream_control::cancellation_context

Opaque cancellation predicate state.

Synopsis

void* cancellation_context = nullptr;

webcpp::beast::wasi::stream_control::cancelled

Optional cancellation predicate.

Synopsis

bool(* cancelled)(void*) = nullptr;

webcpp::beast::wasi::stream_control::deadline

Absolute deadline, or the maximum time point for none.

Synopsis

std::chrono::steady_clock::time_point deadline = std::chrono::steady_clock::time_point::max();

webcpp::beast::wasi::supplied_stream

A borrowed pair of nonblocking host channels.

Synopsis

class supplied_stream;

Description

A zero-byte successful read means EOF. A write of zero bytes means would-block. Providers report would_block when unready and wait handles readiness, deadline and cancellation. The adapter never buffers more than the caller supplies, never closes a channel, and promises no path addressing, socket options or peer credentials.

Type Aliases

Name Description

read_function

Partial nonblocking read callback.

wait_function

Readiness callback, with writing true for output.

write_function

Partial nonblocking write callback.

Member Functions

Name Description

supplied_stream [constructor]

Borrows a caller-supplied channel pair.

control

Sets transfer cancellation and deadline.

read_some

Reads a partial mutable buffer sequence.

write_some

Writes a partial constant buffer sequence.

webcpp::beast::wasi::supplied_stream::read_function

Partial nonblocking read callback.

Synopsis

using read_function = std::size_t(*)(void*, std::span<char>, boost::system::error_code&);

Return Value

The number of bytes transferred before completion or failure.

webcpp::beast::wasi::supplied_stream::wait_function

Readiness callback, with writing true for output.

Synopsis

using wait_function = void(*)(void*, bool, stream_control const&, boost::system::error_code&);

Return Value

The corresponding Boost.System error value.

webcpp::beast::wasi::supplied_stream::write_function

Partial nonblocking write callback.

Synopsis

using write_function = std::size_t(*)(void*, std::span<char const>, boost::system::error_code&);

Return Value

The number of bytes transferred before completion or failure.

webcpp::beast::wasi::supplied_stream::supplied_stream

Borrows a caller-supplied channel pair.

Synopsis

supplied_stream(
    void* context,
    read_function reader,
    write_function writer,
    wait_function wait,
    stream_control control = {});

Parameters

Name Description

context

State shared by channel callbacks.

reader

Nonblocking partial read callback.

writer

Nonblocking partial write callback.

wait

Readiness and cancellation callback.

control

Initial cancellation and deadline.

webcpp::beast::wasi::supplied_stream::control

Sets transfer cancellation and deadline.

Synopsis

void
control(stream_control value);

Parameters

Name Description

value

Settings for subsequent operations.

webcpp::beast::wasi::supplied_stream::read_some

Reads a partial mutable buffer sequence.

Synopsis

template<class MutableBuffers>
std::size_t
read_some(
    MutableBuffers const& buffers,
    boost::system::error_code& error);

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

MutableBuffers

Asio mutable buffer sequence.

Parameters

Name Description

buffers

Destination buffers.

error

Receives transfer failure or end_of_stream.

webcpp::beast::wasi::supplied_stream::write_some

Writes a partial constant buffer sequence.

Synopsis

template<class ConstBuffers>
std::size_t
write_some(
    ConstBuffers const& buffers,
    boost::system::error_code& error);

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

ConstBuffers

Asio constant buffer sequence.

Parameters

Name Description

buffers

Source buffers.

error

Receives any transfer failure.

webcpp::beast::wasi::async_perform

Asynchronously performs a host client exchange with bounded readiness steps.

Synopsis

template<
    class RequestBody,
    class RequestFields,
    class ResponseBody,
    class ResponseFields,
    class CompletionToken,
    class Trailers = webcpp::beast_backend::http::fields>
auto
async_perform(
    http_context& context,
    client& connection,
    http::request<RequestBody, RequestFields>& request,
    http::response<ResponseBody, ResponseFields>& response,
    CompletionToken&& token,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers* response_trailers = nullptr,
    Trailers const* request_trailers = nullptr);

Return Value

The completion token’s result, with decoded response payload byte count.

Template Parameters

Name Description

RequestBody

Outgoing body type.

RequestFields

Outgoing fields type.

ResponseBody

Incoming body type.

ResponseFields

Incoming fields type.

CompletionToken

Token accepting void(error_code, size_t).

Trailers

Trailer fields type.

Parameters

Name Description

context

Context driving host readiness.

connection

Host client whose metadata storage remains alive through completion.

request

Source message kept alive through completion.

response

Initially empty destination kept alive through completion.

token

Completion token preserving executor, allocator and cancellation slot.

options

Body limit, cancellation and deadline.

response_trailers

Optional destination kept alive through completion.

request_trailers

Optional source kept alive through completion.

webcpp::beast::wasi::async_receive

Asynchronously reads a complete host request with bounded readiness steps.

Synopsis

template<
    class Body,
    class Fields,
    class CompletionToken,
    class Trailers = webcpp::beast_backend::http::fields>
auto
async_receive(
    http_context& context,
    /* implementation-defined */::incoming_request& source,
    http::request<Body, Fields>& request,
    CompletionToken&& token,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers* trailers = nullptr);

Return Value

The completion token’s result.

Template Parameters

Name Description

Body

Destination body type.

Fields

Destination fields type.

CompletionToken

Token accepting void(error_code, size_t).

Trailers

Trailer fields type.

Parameters

Name Description

context

Context driving host readiness.

source

Incoming resource kept alive through completion.

request

Initially empty destination kept alive through completion.

token

Completion token preserving executor, allocator and cancellation slot.

options

Body limit, cancellation and deadline.

trailers

Optional destination kept alive through completion.

webcpp::beast::wasi::async_send

Asynchronously commits and writes one host response with bounded readiness steps.

Synopsis

template<
    class Body,
    class Fields,
    class CompletionToken,
    class Trailers = webcpp::beast_backend::http::fields>
auto
async_send(
    http_context& context,
    /* implementation-defined */::response_out output,
    http::response<Body, Fields>& response,
    CompletionToken&& token,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers const* trailers = nullptr);

Return Value

The completion token’s result.

Template Parameters

Name Description

Body

Source body type.

Fields

Source fields type.

CompletionToken

Token accepting void(error_code, size_t).

Trailers

Trailer fields type.

Parameters

Name Description

context

Context driving host readiness.

output

Active response commitment capability.

response

Source message kept alive through completion.

token

Completion token preserving executor, allocator and cancellation slot.

options

Cancellation and deadline.

trailers

Optional source kept alive through completion.

webcpp::beast::wasi::read

Parses one message and retains overread in the caller’s buffer.

Synopsis

template<
    class Stream,
    class DynamicBuffer,
    bool Request,
    class Body,
    class Allocator>
std::size_t
read(
    Stream& stream,
    DynamicBuffer& buffer,
    http::parser<Request, Body, Allocator>& parser,
    boost::system::error_code& error);

Description

Reads fit the buffer’s remaining maximum capacity. If an incomplete parser needs more input while that capacity is exhausted, reports buffer_overflow.

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

Stream

Supplied stream type.

DynamicBuffer

Dynamic buffer type.

Request

Whether the parser reads a request.

Body

Beast body type.

Allocator

Parser fields allocator.

Parameters

Name Description

stream

Input channel.

buffer

Retained input and overread.

parser

Application parser with its limits.

error

Receives channel or parser failure.

webcpp::beast::wasi::receive

Reads a complete host request into the caller’s allocator.

Synopsis

template<
    class Body,
    class Fields,
    class Trailers = webcpp::beast_backend::http::fields>
std::size_t
receive(
    webcpp::wasi::http::incoming_request& source,
    http::request<Body, Fields>& request,
    boost::system::error_code& error,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers* trailers = nullptr);

Return Value

The number of incoming body payload bytes.

Template Parameters

Name Description

Body

Beast body type with a BodyReader.

Fields

Beast fields type.

Trailers

Output fields type for trailers.

Parameters

Name Description

source

Owned host request.

request

Destination message, initially empty.

error

Receives any transfer or parsing failure.

options

Body limit, cancellation and deadline.

trailers

Optional destination for incoming trailers.

webcpp::beast::wasi::send

Sends one response, returning logical body payload bytes.

Synopsis

template<
    class Body,
    class Fields,
    class Trailers = webcpp::beast_backend::http::fields>
std::size_t
send(
    webcpp::wasi::http::response_out out,
    http::response<Body, Fields>& response,
    boost::system::error_code& error,
    webcpp::wasi::http::transfer_options const& options = transfer_options(),
    Trailers const* trailers = nullptr);

Return Value

The number of outgoing body payload bytes.

Template Parameters

Name Description

Body

Beast body type with a BodyWriter.

Fields

Beast fields type.

Trailers

Input fields type for trailers.

Parameters

Name Description

out

Active response commitment resource.

response

Application response.

error

Receives any transfer failure.

options

Cancellation and deadline.

trailers

Optional outgoing trailers.

webcpp::beast::wasi::write

Serializes one message and returns actual channel bytes.

Synopsis

template<
    class Stream,
    bool Request,
    class Body,
    class Fields>
std::size_t
write(
    Stream& stream,
    http::message<Request, Body, Fields>& message,
    boost::system::error_code& error);

Return Value

The number of bytes transferred before completion or failure.

Template Parameters

Name Description

Stream

Supplied stream type.

Request

Whether the message is a request.

Body

Beast body type.

Fields

Beast fields type.

Parameters

Name Description

stream

Output channel.

message

Application message.

error

Receives channel or serializer failure.

webcpp::beast::wasi::body_reader

Explicit streaming host input, independent of a socket.

Synopsis

using webcpp::wasi::http::body_reader;

webcpp::beast::wasi::body_writer

Explicit streaming host output, independent of a socket.

Synopsis

using webcpp::wasi::http::body_writer;

webcpp::beast::wasi::transfer_options

Transfer limits and cancellation shared with the host HTTP resources.

Synopsis

using webcpp::wasi::http::transfer_options;

webcpp::beast::websocket

Types

Name Description

queue_limits

Bounds bytes buffered for sending and awaiting application reads.

stream

Browser WebSocket with layered operations and Asio completion tokens.

stream_base

Browser-compatible options, with a deferred allocator-aware decorator.

Type Aliases

Name Description

request_type

HTTP request shape supplied to a WebSocket decorator.

Enums

Name Description

frame_type

Kind of WebSocket control event.

Using Declarations

Name Description

close_code

WebSocket close status codes.

close_reason

WebSocket close status and UTF-8 explanation.

error

Errors produced by WebSocket protocol operations.

is_upgrade

Tests whether a request asks to upgrade to WebSocket.

permessage_deflate

Compatibility record for browser-owned compression negotiation.

ping_data

Payload type for a WebSocket control frame.

response_type

HTTP response shape used by the guest WebSocket engine.

webcpp::beast::websocket::request_type

HTTP request shape supplied to a WebSocket decorator.

Synopsis

using request_type = webcpp::beast_backend::http::request<webcpp::beast_backend::http::empty_body, webcpp::beast_backend::http::basic_fields<std::pmr::polymorphic_allocator<char>>>;

webcpp::beast::websocket::queue_limits

Bounds bytes buffered for sending and awaiting application reads.

Synopsis

struct queue_limits;

Data Members

Name Description

receive

Maximum retained payload plus message-record bytes in Wasm, defaulting to 4 MiB.

send

Maximum combined bufferedAmount and unsent fragment bytes, defaulting to 4 MiB.

webcpp::beast::websocket::queue_limits::receive

Maximum retained payload plus message-record bytes in Wasm, defaulting to 4 MiB.

Synopsis

std::size_t receive = 4 * 1024 * 1024;

Description

Includes browser arrivals awaiting executor dispatch, even while the context is stopped.

webcpp::beast::websocket::queue_limits::send

Maximum combined bufferedAmount and unsent fragment bytes, defaulting to 4 MiB.

Synopsis

std::size_t send = 4 * 1024 * 1024;

webcpp::beast::websocket::stream

Browser WebSocket with layered operations and Asio completion tokens.

Synopsis

template<
    class NextLayer,
    bool DeflateSupported = true>
class stream;

Types

Name Description

rebind_executor

Selects the stream type for a different executor.

Type Aliases

Name Description

executor_type

Executor used to schedule stream operations and their completions.

next_layer_type

Type of the layer immediately below this stream.

Member Functions

Name Description

stream [constructor]

Constructors

~stream [destructor]

Aborts pending host operations and releases browser registrations.

operator=

Disables assignment of stream ownership.

async_close

Performs the browser closing handshake and waits for its close event.

async_handshake

Opens a browser WebSocket using the recorded authority and request target.

async_ping

Completes according to the unsupported-operation policy for browser-owned control frames.

async_pong

Completes according to the unsupported-operation policy for browser-owned control frames.

async_read

Receives one complete WebSocket message into a dynamic buffer.

async_read_some

Receives part of one queued WebSocket message.

async_write

Submits a complete message to the browser send queue.

async_write_some

Buffers a message fragment and submits the assembled final message.

auto_fragment

auto_fragment overloads

binary

binary overloads

close

Performs the browser closing handshake and waits for its close event.

control_callback

Installs the callback notified of browser-visible close events.

get_executor

Returns the executor used for asynchronous completions.

got_binary

Reports whether the last read delivered a binary message.

got_text

Reports whether the last read delivered a text message.

handshake

Opens a browser WebSocket using the recorded authority and request target.

is_message_done

Reports whether the last read reached the end of its message.

is_open

Reports whether the browser WebSocket is currently open.

next_layer

Returns the immediately underlying layer.

read

Receives one complete WebSocket message into a dynamic buffer.

read_message_max

read_message_max overloads

reason

Returns the last close status and reason exposed by the browser.

set_option

set_option overloads

text

text overloads

write

Submits a complete message to the browser send queue.

write_buffer_bytes

write_buffer_bytes overloads

write_some

Buffers a message fragment and submits the assembled final message.

Specializations

Name Description

stream<NextLayer, DeflateSupported>

Selects upstream framing for an explicitly supplied byte stream.

Template Parameters

Name Description

NextLayer

Underlying browser authority or TLS-intent layer.

DeflateSupported

Compatibility parameter; the browser owns extension negotiation.

webcpp::beast::websocket::stream::executor_type

Executor used to schedule stream operations and their completions.

Synopsis

using executor_type = NextLayer::executor_type;

webcpp::beast::websocket::stream::next_layer_type

Type of the layer immediately below this stream.

Synopsis

using next_layer_type = NextLayer;

webcpp::beast::websocket::stream::rebind_executor

Selects the stream type for a different executor.

Synopsis

template<class Executor>
struct rebind_executor;

Type Aliases

Name Description

other

Stream type with the requested executor binding.

Template Parameters

Name Description

Executor

Executor type to bind to the underlying layer.

webcpp::beast::websocket::stream::rebind_executor::other

Stream type with the requested executor binding.

webcpp::beast::websocket::stream::stream

Constructors

Synopses

Disables copying of stream ownership.

stream(stream const&) = delete;

Transfers the stream and its pending operation ownership.

stream(stream&& other) noexcept;

Constructs the next layer and allocator-owned WebSocket state.

template<
    class First,
    class... Args>
requires (!std::is_same_v<std::remove_cvref_t<First>, std::allocator_arg_t>)
explicit
stream(
    First&& first,
    Args&&... args);

Constructs the next layer and allocator-owned WebSocket state.

template<
    class Allocator,
    class... Args>
explicit
stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    Args&&... args);

Template Parameters

Name Description

First

Type of the first argument forwarded to the next layer.

Args

Types of the remaining arguments forwarded to the next layer.

Allocator

Allocator used for owned state and variable-sized stream storage.

Parameters

Name Description

other

Stream whose state and operation ownership are transferred.

first

First argument forwarded to the next layer constructor.

args

Remaining arguments forwarded to the next layer constructor.

allocator

Allocator retained for stream-owned storage.

webcpp::beast::websocket::stream::stream

Disables copying of stream ownership.

Synopsis

stream(stream const&) = delete;

webcpp::beast::websocket::stream::stream

Transfers the stream and its pending operation ownership.

Synopsis

stream(stream&& other) noexcept;

Parameters

Name Description

other

Stream whose state and operation ownership are transferred.

webcpp::beast::websocket::stream::stream

Constructs the next layer and allocator-owned WebSocket state.

Synopsis

template<
    class First,
    class... Args>
requires (!std::is_same_v<std::remove_cvref_t<First>, std::allocator_arg_t>)
explicit
stream(
    First&& first,
    Args&&... args);

Template Parameters

Name Description

First

Type of the first argument forwarded to the next layer.

Args

Types of the remaining arguments forwarded to the next layer.

Parameters

Name Description

first

First argument forwarded to the next layer constructor.

args

Remaining arguments forwarded to the next layer constructor.

webcpp::beast::websocket::stream::stream

Constructs the next layer and allocator-owned WebSocket state.

Synopsis

template<
    class Allocator,
    class... Args>
explicit
stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    Args&&... args);

Template Parameters

Name Description

Allocator

Allocator used for owned state and variable-sized stream storage.

Args

Types of the remaining arguments forwarded to the next layer.

Parameters

Name Description

allocator

Allocator retained for stream-owned storage.

args

Remaining arguments forwarded to the next layer constructor.

webcpp::beast::websocket::stream::~stream

Aborts pending host operations and releases browser registrations.

Synopsis

~stream();

webcpp::beast::websocket::stream::operator=

Disables assignment of stream ownership.

Synopses

Disables assignment of stream ownership.

stream&
operator=(stream const&) = delete;

Disables assignment of stream ownership.

stream&
operator=(stream&&) = delete;

webcpp::beast::websocket::stream::operator=

Disables assignment of stream ownership.

Synopsis

stream&
operator=(stream const&) = delete;

webcpp::beast::websocket::stream::operator=

Disables assignment of stream ownership.

Synopsis

stream&
operator=(stream&&) = delete;

webcpp::beast::websocket::stream::async_close

Performs the browser closing handshake and waits for its close event.

Synopsis

template<class Token>
auto
async_close(
    webcpp::beast_backend::websocket::close_reason reason,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

reason

Close code and UTF-8 reason passed to the browser.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_handshake

Opens a browser WebSocket using the recorded authority and request target.

Synopsis

template<class Token>
auto
async_handshake(
    webcpp::beast_backend::string_view host,
    webcpp::beast_backend::string_view target,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

target

Origin-form path and query for the browser URL.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_ping

Completes according to the unsupported-operation policy for browser-owned control frames.

Synopsis

template<class Token>
auto
async_ping(
    webcpp::beast_backend::websocket::ping_data const&,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_pong

Completes according to the unsupported-operation policy for browser-owned control frames.

Synopsis

template<class Token>
auto
async_pong(
    webcpp::beast_backend::websocket::ping_data const& data,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

data

Control payload, which the browser cannot transmit explicitly.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_read

Receives one complete WebSocket message into a dynamic buffer.

Synopsis

template<
    class DynamicBuffer,
    class Token>
auto
async_read(
    DynamicBuffer& buffer,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Cancellation leaves queued messages available for a subsequent read. Only one read may be outstanding, and the destination must outlive completion.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

DynamicBuffer

DynamicBuffer type receiving message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffer

Dynamic buffer receiving message bytes and retained until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_read_some

Receives part of one queued WebSocket message.

Synopses

Receives part of one queued WebSocket message.

template<
    class Buffers,
    class Token>
auto
async_read_some(
    Buffers const& buffers,
    Token&& token);

Receives part of one queued WebSocket message.

template<
    class DynamicBuffer,
    class Token>
auto
async_read_some(
    DynamicBuffer& buffer,
    std::size_t maximum,
    Token&& token);

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Token

Asio completion token selecting the asynchronous result type.

DynamicBuffer

DynamicBuffer type receiving message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

buffer

Dynamic buffer receiving message bytes and retained until completion.

maximum

Maximum message bytes to append in this read.

webcpp::beast::websocket::stream::async_read_some

Receives part of one queued WebSocket message.

Synopsis

template<
    class Buffers,
    class Token>
auto
async_read_some(
    Buffers const& buffers,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Cancellation leaves queued messages available for a subsequent read. Only one read may be outstanding, and the destination must outlive completion.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

MutableBufferSequence receiving response or message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_read_some

Receives part of one queued WebSocket message.

Synopsis

template<
    class DynamicBuffer,
    class Token>
auto
async_read_some(
    DynamicBuffer& buffer,
    std::size_t maximum,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Cancellation leaves queued messages available for a subsequent read. Only one read may be outstanding, and the destination must outlive completion.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

DynamicBuffer

DynamicBuffer type receiving message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffer

Dynamic buffer receiving message bytes and retained until completion.

maximum

Maximum message bytes to append in this read.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_write

Submits a complete message to the browser send queue.

Synopsis

template<
    class Buffers,
    class Token>
auto
async_write(
    Buffers const& buffers,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Success means the browser accepted the bytes into its queue, not that the peer read them. Exceeding queue_limits::send closes the connection with browser_errc::send_limit.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::async_write_some

Buffers a message fragment and submits the assembled final message.

Synopsis

template<
    class Buffers,
    class Token>
auto
async_write_some(
    bool fin,
    Buffers const& buffers,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, std::size_t). Success means the browser accepted the bytes into its queue, not that the peer read them. Exceeding queue_limits::send closes the connection with browser_errc::send_limit.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

fin

Whether this fragment finishes the message and submits it to the browser.

buffers

Buffer sequence whose storage remains valid until completion.

token

Completion token controlling handler construction and the return type.

webcpp::beast::websocket::stream::auto_fragment

auto_fragment overloads

Synopses

Reports that fragmentation is owned by the browser.

[[nodiscard]]
bool
auto_fragment() const noexcept;

Accepts the browser-owned fragmentation setting.

void
auto_fragment(bool) noexcept;

Return Value

True, because browser framing is not application-controlled.

webcpp::beast::websocket::stream::auto_fragment

Reports that fragmentation is owned by the browser.

Synopsis

[[nodiscard]]
bool
auto_fragment() const noexcept;

Return Value

True, because browser framing is not application-controlled.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::auto_fragment

Accepts the browser-owned fragmentation setting.

Synopsis

void
auto_fragment(bool) noexcept;

webcpp::beast::websocket::stream::binary

binary overloads

Synopses

Reports whether subsequent messages use binary mode.

[[nodiscard]]
bool
binary() const noexcept;

Selects binary mode for subsequent messages.

void
binary(bool value) noexcept;

Return Value

True if outgoing messages use binary mode.

Parameters

Name Description

value

Whether subsequent messages are binary.

webcpp::beast::websocket::stream::binary

Reports whether subsequent messages use binary mode.

Synopsis

[[nodiscard]]
bool
binary() const noexcept;

Return Value

True if outgoing messages use binary mode.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::binary

Selects binary mode for subsequent messages.

Synopsis

void
binary(bool value) noexcept;

Parameters

Name Description

value

Whether subsequent messages are binary.

webcpp::beast::websocket::stream::close

Performs the browser closing handshake and waits for its close event.

Synopses

Performs the browser closing handshake and waits for its close event.

void
close(webcpp::beast_backend::websocket::close_reason reason);

Performs the browser closing handshake and waits for its close event.

void
close(
    webcpp::beast_backend::websocket::close_reason reason,
    ec_type& ec);

Parameters

Name Description

reason

Close code and UTF-8 reason passed to the browser.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::close

Performs the browser closing handshake and waits for its close event.

Synopsis

void
close(webcpp::beast_backend::websocket::close_reason reason);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Parameters

Name Description

reason

Close code and UTF-8 reason passed to the browser.

webcpp::beast::websocket::stream::close

Performs the browser closing handshake and waits for its close event.

Synopsis

void
close(
    webcpp::beast_backend::websocket::close_reason reason,
    ec_type& ec);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Parameters

Name Description

reason

Close code and UTF-8 reason passed to the browser.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::control_callback

Installs the callback notified of browser-visible close events.

Synopsis

template<class Function>
void
control_callback(Function function);

Template Parameters

Name Description

Function

Callable stored for request decoration or control notification.

Parameters

Name Description

function

Callable receiving the control frame kind and payload.

webcpp::beast::websocket::stream::get_executor

Returns the executor used for asynchronous completions.

Synopsis

[[nodiscard]]
executor_type
get_executor() const;

Return Value

The executor associated with the underlying context.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::got_binary

Reports whether the last read delivered a binary message.

Synopsis

[[nodiscard]]
bool
got_binary() const noexcept;

Return Value

True if the last delivered message was binary.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::got_text

Reports whether the last read delivered a text message.

Synopsis

[[nodiscard]]
bool
got_text() const noexcept;

Return Value

True if the last delivered message was text.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::handshake

Opens a browser WebSocket using the recorded authority and request target.

Synopses

Opens a browser WebSocket using the recorded authority and request target.

void
handshake(
    webcpp::beast_backend::string_view host,
    webcpp::beast_backend::string_view target);

Opens a browser WebSocket using the recorded authority and request target.

void
handshake(
    webcpp::beast_backend::string_view host,
    webcpp::beast_backend::string_view target,
    ec_type& ec);

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

target

Origin-form path and query for the browser URL.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::handshake

Opens a browser WebSocket using the recorded authority and request target.

Synopsis

void
handshake(
    webcpp::beast_backend::string_view host,
    webcpp::beast_backend::string_view target);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

target

Origin-form path and query for the browser URL.

webcpp::beast::websocket::stream::handshake

Opens a browser WebSocket using the recorded authority and request target.

Synopsis

void
handshake(
    webcpp::beast_backend::string_view host,
    webcpp::beast_backend::string_view target,
    ec_type& ec);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

target

Origin-form path and query for the browser URL.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::is_message_done

Reports whether the last read reached the end of its message.

Synopsis

[[nodiscard]]
bool
is_message_done() const noexcept;

Return Value

True when the last read consumed the message boundary.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::is_open

Reports whether the browser WebSocket is currently open.

Synopsis

[[nodiscard]]
bool
is_open() const noexcept;

Return Value

True when the layer is available for operations.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::next_layer

Returns the immediately underlying layer.

Synopses

Returns the immediately underlying layer.

NextLayer&
next_layer() noexcept;

Returns the immediately underlying layer.

[[nodiscard]]
NextLayer const&
next_layer() const noexcept;

Return Value

A reference to the underlying stream.

webcpp::beast::websocket::stream::next_layer

Returns the immediately underlying layer.

Synopsis

NextLayer&
next_layer() noexcept;

Return Value

A reference to the underlying stream.

webcpp::beast::websocket::stream::next_layer

Returns the immediately underlying layer.

Synopsis

[[nodiscard]]
NextLayer const&
next_layer() const noexcept;

Return Value

A reference to the underlying stream.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::read

Receives one complete WebSocket message into a dynamic buffer.

Synopses

Receives one complete WebSocket message into a dynamic buffer.

template<class Buffer>
std::size_t
read(Buffer& buffer);

Receives one complete WebSocket message into a dynamic buffer.

template<class Buffer>
std::size_t
read(
    Buffer& buffer,
    ec_type& ec);

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffer

Dynamic buffer type retained for Beast call compatibility.

Parameters

Name Description

buffer

Dynamic buffer receiving message bytes and retained until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::read

Receives one complete WebSocket message into a dynamic buffer.

Synopsis

template<class Buffer>
std::size_t
read(Buffer& buffer);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffer

Dynamic buffer type retained for Beast call compatibility.

Parameters

Name Description

buffer

Dynamic buffer receiving message bytes and retained until completion.

webcpp::beast::websocket::stream::read

Receives one complete WebSocket message into a dynamic buffer.

Synopsis

template<class Buffer>
std::size_t
read(
    Buffer& buffer,
    ec_type& ec);

Description

This synchronous facade suspends the main stack through JSPI or Asyncify. Calling it from an executing handler returns operation_not_supported.

Return Value

The number of bytes delivered to the destination.

Template Parameters

Name Description

Buffer

Dynamic buffer type retained for Beast call compatibility.

Parameters

Name Description

buffer

Dynamic buffer receiving message bytes and retained until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::read_message_max

read_message_max overloads

Synopses

Returns the maximum accepted decoded message size.

[[nodiscard]]
std::size_t
read_message_max() const noexcept;

Sets the largest decoded message accepted from the browser.

void
read_message_max(std::size_t value) noexcept;

Return Value

The maximum accepted message bytes.

Parameters

Name Description

value

Maximum decoded message bytes; the default is 16 MiB.

webcpp::beast::websocket::stream::read_message_max

Returns the maximum accepted decoded message size.

Synopsis

[[nodiscard]]
std::size_t
read_message_max() const noexcept;

Return Value

The maximum accepted message bytes.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::read_message_max

Sets the largest decoded message accepted from the browser.

Synopsis

void
read_message_max(std::size_t value) noexcept;

Parameters

Name Description

value

Maximum decoded message bytes; the default is 16 MiB.

webcpp::beast::websocket::stream::reason

Returns the last close status and reason exposed by the browser.

Synopsis

[[nodiscard]]
webcpp::beast_backend::websocket::close_reason const&
reason() const noexcept;

Return Value

The most recently observed close reason.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::set_option

set_option overloads

Synopses

Sets the byte limits enforced for outgoing and unread messages.

void
set_option(queue_limits value);

Accepts browser-owned compression negotiation options.

void
set_option(webcpp::beast_backend::websocket::permessage_deflate const&) noexcept;

Records timeout settings for subsequent host operations.

void
set_option(stream_base::timeout const& value);

Stores a request decorator using the stream allocator.

template<class Function>
void
set_option(stream_base::decorator<Function> value);

Template Parameters

Name Description

Function

Callable stored for request decoration or control notification.

Parameters

Name Description

value

Options to retain for subsequent operations.

webcpp::beast::websocket::stream::set_option

Sets the byte limits enforced for outgoing and unread messages.

Synopsis

void
set_option(queue_limits value);

Parameters

Name Description

value

Options to retain for subsequent operations.

webcpp::beast::websocket::stream::set_option

Accepts browser-owned compression negotiation options.

Synopsis

void
set_option(webcpp::beast_backend::websocket::permessage_deflate const&) noexcept;

webcpp::beast::websocket::stream::set_option

Records timeout settings for subsequent host operations.

Synopsis

void
set_option(stream_base::timeout const& value);

Parameters

Name Description

value

Options to retain for subsequent operations.

webcpp::beast::websocket::stream::set_option

Stores a request decorator using the stream allocator.

Synopsis

template<class Function>
void
set_option(stream_base::decorator<Function> value);

Template Parameters

Name Description

Function

Callable stored for request decoration or control notification.

Parameters

Name Description

value

Options to retain for subsequent operations.

webcpp::beast::websocket::stream::text

text overloads

Synopses

Reports whether subsequent messages use text mode.

[[nodiscard]]
bool
text() const noexcept;

Selects text mode for subsequent messages.

void
text(bool value) noexcept;

Return Value

True if outgoing messages use text mode.

Parameters

Name Description

value

Whether subsequent messages are text.

webcpp::beast::websocket::stream::text

Reports whether subsequent messages use text mode.

Synopsis

[[nodiscard]]
bool
text() const noexcept;

Return Value

True if outgoing messages use text mode.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::text

Selects text mode for subsequent messages.

Synopsis

void
text(bool value) noexcept;

Parameters

Name Description

value

Whether subsequent messages are text.

webcpp::beast::websocket::stream::write

Submits a complete message to the browser send queue.

Synopses

Submits a complete message to the browser send queue.

template<class Buffers>
std::size_t
write(Buffers const& buffers);

Submits a complete message to the browser send queue.

template<class Buffers>
std::size_t
write(
    Buffers const& buffers,
    ec_type& ec);

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::write

Submits a complete message to the browser send queue.

Synopsis

template<class Buffers>
std::size_t
write(Buffers const& buffers);

Description

Success means the browser accepted the bytes into its queue, not that the peer read them. Exceeding queue_limits::send closes the connection with browser_errc::send_limit.

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

webcpp::beast::websocket::stream::write

Submits a complete message to the browser send queue.

Synopsis

template<class Buffers>
std::size_t
write(
    Buffers const& buffers,
    ec_type& ec);

Description

Success means the browser accepted the bytes into its queue, not that the peer read them. Exceeding queue_limits::send closes the connection with browser_errc::send_limit.

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream::write_buffer_bytes

write_buffer_bytes overloads

Synopses

Returns the compatibility write-buffer hint.

[[nodiscard]]
std::size_t
write_buffer_bytes() const noexcept;

Accepts a compatibility buffer hint without changing browser buffering.

void
write_buffer_bytes(std::size_t) noexcept;

Return Value

The compatibility value 4096.

webcpp::beast::websocket::stream::write_buffer_bytes

Returns the compatibility write-buffer hint.

Synopsis

[[nodiscard]]
std::size_t
write_buffer_bytes() const noexcept;

Return Value

The compatibility value 4096.

Note

The return value should not be discarded.

webcpp::beast::websocket::stream::write_buffer_bytes

Accepts a compatibility buffer hint without changing browser buffering.

Synopsis

void
write_buffer_bytes(std::size_t) noexcept;

webcpp::beast::websocket::stream::write_some

Buffers a message fragment and submits the assembled final message.

Synopsis

template<class Buffers>
std::size_t
write_some(
    bool fin,
    Buffers const& buffers,
    ec_type& ec);

Description

Success means the browser accepted the bytes into its queue, not that the peer read them. Exceeding queue_limits::send closes the connection with browser_errc::send_limit.

Return Value

The number of input bytes accepted, or zero on failure.

Template Parameters

Name Description

Buffers

ConstBufferSequence providing request or message bytes.

Parameters

Name Description

fin

Whether this fragment finishes the message and submits it to the browser.

buffers

Buffer sequence whose storage remains valid until completion.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>

Selects upstream framing for an explicitly supplied byte stream.

Synopsis

template<
    class NextLayer,
    bool DeflateSupported>
requires (!std::is_same_v<NextLayer, tcp_stream> &&
             !std::is_same_v<NextLayer, ssl_stream<tcp_stream>>)
class stream<NextLayer, DeflateSupported>
    : public webcpp::beast_backend::websocket::stream<NextLayer, DeflateSupported>

Base Classes

Name Description

webcpp::beast_backend::websocket::stream<NextLayer, DeflateSupported>

Types

Name Description

rebind_executor

Selects the guest stream type for another executor.

Member Functions

Name Description

stream [constructor]

Constructs the guest engine with the upstream allocation behavior.

control_callback

Registers a control notification using the facade’s portable frame category.

set_option

Adapts facade request and response decorators to the upstream handshake.

Using Declarations

Template Parameters

Name Description

NextLayer

User-supplied stream implementing the Beast byte-stream concepts.

DeflateSupported

Whether the guest engine supports permessage-deflate.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::rebind_executor

Selects the guest stream type for another executor.

Synopsis

template<class Executor>
struct rebind_executor;

Type Aliases

Name Description

other

Stream type with the requested executor binding.

Template Parameters

Name Description

Executor

Executor to bind to the next layer.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::rebind_executor::other

Stream type with the requested executor binding.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::stream

Constructs the guest engine with the upstream allocation behavior.

Synopsis

template<
    class Allocator,
    class... Args>
explicit
stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    Args&&... args);

Description

The allocator argument preserves constructor compatibility; Boost owns its protocol state.

Template Parameters

Name Description

Allocator

Allocator used for the facade’s request adaptation.

Args

Constructor argument types of the next layer.

Parameters

Name Description

allocator

Allocator retained for the facade’s request adaptation.

args

Arguments forwarded to the upstream stream constructor.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::control_callback

Registers a control notification using the facade’s portable frame category.

Synopsis

void
control_callback(std::function<void(frame_type, webcpp::beast_backend::string_view)> callback);

Parameters

Name Description

callback

Callback invoked with the frame category and payload, or empty to clear.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::set_option

Adapts facade request and response decorators to the upstream handshake.

Synopsis

template<class Function>
void
set_option(stream_base::decorator<Function> option);

Template Parameters

Name Description

Function

Callable accepting the facade request or response type.

Parameters

Name Description

option

Decorator applied before the guest engine writes its handshake.

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::Unnamed using

Synopsis

using base::;

webcpp::beast::websocket::stream<NextLayer, DeflateSupported>::set_option

Synopsis

using base::set_option;

webcpp::beast::websocket::stream_base

Browser-compatible options, with a deferred allocator-aware decorator.

Synopsis

struct stream_base;

Types

Name Description

decorator

Stores a callable that records the browser-compatible handshake subprotocols.

Type Aliases

Name Description

timeout

Handshake and idle timeout options shared with Beast.

webcpp::beast::websocket::stream_base::timeout

Handshake and idle timeout options shared with Beast.

Synopsis

using timeout = webcpp::beast_backend::websocket::stream_base::timeout;

webcpp::beast::websocket::stream_base::decorator

Stores a callable that records the browser-compatible handshake subprotocols.

Synopsis

template<class Function>
struct decorator;

Member Functions

Name Description

decorator [constructor]

Retains a handshake request decorator.

Data Members

Name Description

function

Callable retained for later protocol notification.

Template Parameters

Name Description

Function

Callable stored for request decoration or control notification.

webcpp::beast::websocket::stream_base::decorator::decorator

Retains a handshake request decorator.

Synopsis

explicit
decorator(Function fn);

Parameters

Name Description

fn

Callable invoked with the handshake request before opening the browser socket.

webcpp::beast::websocket::stream_base::decorator::function

Callable retained for later protocol notification.

Synopsis

Function function;

webcpp::beast::websocket::frame_type

Kind of WebSocket control event.

Synopsis

enum class frame_type : int;

Members

Name Description

close

A closing handshake notification.

ping

A browser-owned ping control frame.

pong

A browser-owned pong control frame.

webcpp::beast::websocket::close_code

WebSocket close status codes.

Synopsis

using webcpp::beast_backend::websocket::close_code;

webcpp::beast::websocket::close_reason

WebSocket close status and UTF-8 explanation.

Synopsis

using webcpp::beast_backend::websocket::close_reason;

webcpp::beast::websocket::error

Errors produced by WebSocket protocol operations.

Synopsis

using webcpp::beast_backend::websocket::error;

webcpp::beast::websocket::is_upgrade

Tests whether a request asks to upgrade to WebSocket.

Synopsis

using webcpp::beast_backend::websocket::is_upgrade;

webcpp::beast::websocket::permessage_deflate

Compatibility record for browser-owned compression negotiation.

Synopsis

using webcpp::beast_backend::websocket::permessage_deflate;

webcpp::beast::websocket::ping_data

Payload type for a WebSocket control frame.

Synopsis

using webcpp::beast_backend::websocket::ping_data;

webcpp::beast::websocket::response_type

HTTP response shape used by the guest WebSocket engine.

Synopsis

using webcpp::beast_backend::websocket::response_type;

webcpp::beast::errc

Upstream generic error conditions.

Synopsis

Declared in <webcpp/beast/core.hpp>

namespace errc = webcpp::beast_backend::errc;

webcpp::beast::ssl_stream

TLS intent validated before the browser owns the secure connection.

Synopsis

template<class NextLayer>
class ssl_stream;

Types

Name Description

rebind_executor

Selects the stream type for a different executor.

Type Aliases

Name Description

executor_type

Executor used to schedule stream operations and their completions.

next_layer_type

Type of the layer immediately below this stream.

Member Functions

Name Description

ssl_stream [constructor]

Constructors

async_handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

async_shutdown

Closes the browser operation associated with the underlying authority.

get_executor

Returns the executor used for asynchronous completions.

handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

next_layer

Returns the immediately underlying layer.

set_server_name

Records the requested TLS server name for authority validation.

set_verify_callback

Records hostname verification or marks a custom callback unsupported.

set_verify_mode

Records the verification policy for the next TLS-intent validation.

shutdown

shutdown overloads

Template Parameters

Name Description

NextLayer

Underlying browser authority or TLS-intent layer.

webcpp::beast::ssl_stream::executor_type

Executor used to schedule stream operations and their completions.

Synopsis

using executor_type = NextLayer::executor_type;

webcpp::beast::ssl_stream::next_layer_type

Type of the layer immediately below this stream.

Synopsis

using next_layer_type = NextLayer;

webcpp::beast::ssl_stream::rebind_executor

Selects the stream type for a different executor.

Synopsis

template<class Executor>
struct rebind_executor;

Type Aliases

Name Description

other

Stream type with the requested executor binding.

Template Parameters

Name Description

Executor

Executor type to bind to the underlying layer.

webcpp::beast::ssl_stream::rebind_executor::other

Stream type with the requested executor binding.

webcpp::beast::ssl_stream::ssl_stream

Constructors

Synopses

Constructs the next layer and snapshots browser TLS policy.

template<class Arg>
ssl_stream(
    Arg&& arg,
    webcpp::asio::ssl::context& context);

Constructs every layer and copied TLS name with the supplied allocator.

template<
    class Allocator,
    class Arg>
ssl_stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    Arg&& arg,
    webcpp::asio::ssl::context& context);

Template Parameters

Name Description

Arg

Argument forwarded to construct the next layer.

Allocator

Allocator retained for owned stream state.

Parameters

Name Description

arg

Argument forwarded to the underlying layer constructor.

context

TLS context whose configuration is copied at construction.

allocator

Allocator used by the layer and its TLS metadata.

webcpp::beast::ssl_stream::ssl_stream

Constructs the next layer and snapshots browser TLS policy.

Synopsis

template<class Arg>
ssl_stream(
    Arg&& arg,
    webcpp::asio::ssl::context& context);

Template Parameters

Name Description

Arg

Argument forwarded to construct the next layer.

Parameters

Name Description

arg

Argument forwarded to the underlying layer constructor.

context

TLS context whose configuration is copied at construction.

webcpp::beast::ssl_stream::ssl_stream

Constructs every layer and copied TLS name with the supplied allocator.

Synopsis

template<
    class Allocator,
    class Arg>
ssl_stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    Arg&& arg,
    webcpp::asio::ssl::context& context);

Template Parameters

Name Description

Allocator

Allocator retained for owned stream state.

Arg

Argument forwarded to the next layer.

Parameters

Name Description

allocator

Allocator used by the layer and its TLS metadata.

arg

Argument forwarded to the next layer constructor.

context

TLS configuration copied before opening the host connection.

webcpp::beast::ssl_stream::async_handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

Synopsis

template<class Token>
auto
async_handshake(
    webcpp::asio::ssl::stream_base::handshake_type type,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code). The browser performs certificate validation when fetch or WebSocket opens the URL. Under ERROR, custom roots, credentials, version pins, callbacks, or mismatched names produce operation_not_supported; IGNORE leaves those choices to the browser.

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

type

Requested TLS role; only client is representable by browser host APIs.

token

Completion token controlling handler construction and the return type.

webcpp::beast::ssl_stream::async_shutdown

Closes the browser operation associated with the underlying authority.

Synopsis

template<class Token>
auto
async_shutdown(Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

token

Completion token controlling handler construction and the return type.

webcpp::beast::ssl_stream::get_executor

Returns the executor used for asynchronous completions.

Synopsis

[[nodiscard]]
executor_type
get_executor() const;

Return Value

The executor associated with the underlying context.

Note

The return value should not be discarded.

webcpp::beast::ssl_stream::handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

Synopses

Validates TLS intent and marks the authority secure without opening a TLS socket.

void
handshake(webcpp::asio::ssl::stream_base::handshake_type type);

Validates TLS intent and marks the authority secure without opening a TLS socket.

void
handshake(
    webcpp::asio::ssl::stream_base::handshake_type type,
    boost::system::error_code& ec);

Parameters

Name Description

type

Requested TLS role; only client is representable by browser host APIs.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

Synopsis

void
handshake(webcpp::asio::ssl::stream_base::handshake_type type);

Description

The browser performs certificate validation when fetch or WebSocket opens the URL. Under ERROR, custom roots, credentials, version pins, callbacks, or mismatched names produce operation_not_supported; IGNORE leaves those choices to the browser.

Parameters

Name Description

type

Requested TLS role; only client is representable by browser host APIs.

webcpp::beast::ssl_stream::handshake

Validates TLS intent and marks the authority secure without opening a TLS socket.

Synopsis

void
handshake(
    webcpp::asio::ssl::stream_base::handshake_type type,
    boost::system::error_code& ec);

Description

The browser performs certificate validation when fetch or WebSocket opens the URL. Under ERROR, custom roots, credentials, version pins, callbacks, or mismatched names produce operation_not_supported; IGNORE leaves those choices to the browser.

Parameters

Name Description

type

Requested TLS role; only client is representable by browser host APIs.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::next_layer

Returns the immediately underlying layer.

Synopses

Returns the immediately underlying layer.

NextLayer&
next_layer() noexcept;

Returns the immediately underlying layer.

[[nodiscard]]
NextLayer const&
next_layer() const noexcept;

Return Value

A reference to the underlying stream.

webcpp::beast::ssl_stream::next_layer

Returns the immediately underlying layer.

Synopsis

NextLayer&
next_layer() noexcept;

Return Value

A reference to the underlying stream.

webcpp::beast::ssl_stream::next_layer

Returns the immediately underlying layer.

Synopsis

[[nodiscard]]
NextLayer const&
next_layer() const noexcept;

Return Value

A reference to the underlying stream.

Note

The return value should not be discarded.

webcpp::beast::ssl_stream::set_server_name

Records the requested TLS server name for authority validation.

Synopsis

boost::system::result<void>
set_server_name(std::string_view host);

Return Value

Success, or invalid_argument for an invalid server-name record.

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

webcpp::beast::ssl_stream::set_verify_callback

Records hostname verification or marks a custom callback unsupported.

Synopses

Records hostname verification or marks a custom callback unsupported.

template<class Callback>
void
set_verify_callback(Callback const& callback);

Records hostname verification or marks a custom callback unsupported.

template<class Callback>
void
set_verify_callback(
    Callback const& callback,
    boost::system::error_code& ec);

Template Parameters

Name Description

Callback

Verification callable type; only host_name_verification is representable.

Parameters

Name Description

callback

Hostname-verification record or unsupported custom callable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::set_verify_callback

Records hostname verification or marks a custom callback unsupported.

Synopsis

template<class Callback>
void
set_verify_callback(Callback const& callback);

Template Parameters

Name Description

Callback

Verification callable type; only host_name_verification is representable.

Parameters

Name Description

callback

Hostname-verification record or unsupported custom callable.

webcpp::beast::ssl_stream::set_verify_callback

Records hostname verification or marks a custom callback unsupported.

Synopsis

template<class Callback>
void
set_verify_callback(
    Callback const& callback,
    boost::system::error_code& ec);

Template Parameters

Name Description

Callback

Verification callable type; only host_name_verification is representable.

Parameters

Name Description

callback

Hostname-verification record or unsupported custom callable.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::set_verify_mode

Records the verification policy for the next TLS-intent validation.

Synopses

Records the verification policy for the next TLS-intent validation.

void
set_verify_mode(int mode);

Records the verification policy for the next TLS-intent validation.

void
set_verify_mode(
    int mode,
    boost::system::error_code& ec);

Parameters

Name Description

mode

Requested verification flags; strict browser TLS requires verify_peer.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::set_verify_mode

Records the verification policy for the next TLS-intent validation.

Synopsis

void
set_verify_mode(int mode);

Parameters

Name Description

mode

Requested verification flags; strict browser TLS requires verify_peer.

webcpp::beast::ssl_stream::set_verify_mode

Records the verification policy for the next TLS-intent validation.

Synopsis

void
set_verify_mode(
    int mode,
    boost::system::error_code& ec);

Parameters

Name Description

mode

Requested verification flags; strict browser TLS requires verify_peer.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::shutdown

shutdown overloads

Synopses

Closes the browser operation associated with the underlying authority.

void
shutdown();

Closes the browser operation associated with the underlying authority.

void
shutdown(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::ssl_stream::shutdown

Closes the browser operation associated with the underlying authority.

Synopsis

void
shutdown();

webcpp::beast::ssl_stream::shutdown

Closes the browser operation associated with the underlying authority.

Synopsis

void
shutdown(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream

A browser authority record, with Beast’s connection and deadline interface.

Synopsis

class tcp_stream;

Types

Name Description

rebind_executor

Selects the stream type for a different executor.

Type Aliases

Name Description

endpoint_type

Address and service value recorded by connect.

executor_type

Executor used to schedule stream operations and their completions.

lowest_layer_type

The authority record at the bottom of a browser stream stack.

Member Functions

Name Description

tcp_stream [constructor]

Constructors

~tcp_stream [destructor]

Aborts pending host operations and releases browser registrations.

operator=

Disables assignment of stream ownership.

async_connect

Records the destination authority and posts the result.

authority_matches

Checks a hostname or host-and-port against the recorded authority.

bind

Connects host cancellation and closure to the authority record.

cancel

cancel overloads

close

close overloads

connect

Records the destination authority without opening a raw TCP connection.

expires_after

Sets an absolute deadline relative to the current steady-clock time.

expires_at

Sets the deadline for subsequent browser operations.

expires_never

Disables the authority record deadline.

expiry

Returns the deadline recorded for browser operations.

get_executor

Returns the executor used for asynchronous completions.

host

Returns the recorded hostname or bracketed IPv6 address.

is_open

Reports whether a connection authority has been recorded.

port

Returns the recorded service port.

resource

Returns the allocation resource retained by this stream.

resource_owner

Returns shared ownership of the stream allocation resource.

response_body_limit

response_body_limit overloads

secure

secure overloads

shutdown

Closes the browser operation and its authority record.

socket

Returns this authority record through the Beast lowest-layer interface.

url

Builds a browser URL from the recorded authority and request target.

Data Members

Name Description

http_state

Shared fetch transaction storage retained by the authority record.

webcpp::beast::tcp_stream::endpoint_type

Address and service value recorded by connect.

Synopsis

using endpoint_type = webcpp::asio::ip::tcp::endpoint;

webcpp::beast::tcp_stream::executor_type

Executor used to schedule stream operations and their completions.

Synopsis

using executor_type = webcpp::asio_backend::any_io_executor;

webcpp::beast::tcp_stream::lowest_layer_type

The authority record at the bottom of a browser stream stack.

Synopsis

using lowest_layer_type = tcp_stream;

webcpp::beast::tcp_stream::rebind_executor

Selects the stream type for a different executor.

Synopsis

template<class Executor>
struct rebind_executor;

Type Aliases

Name Description

other

Stream type with the requested executor binding.

Template Parameters

Name Description

Executor

Executor type to bind to the underlying layer.

webcpp::beast::tcp_stream::rebind_executor::other

Stream type with the requested executor binding.

Synopsis

using other = tcp_stream;

webcpp::beast::tcp_stream::tcp_stream

Constructors

Synopses

Disables copying of stream ownership.

tcp_stream(tcp_stream const&) = delete;

Transfers the stream and its pending operation ownership.

tcp_stream(tcp_stream&& other) noexcept;

Constructs an authority record with no active connection.

explicit
tcp_stream(executor_type executor);

Constructs an authority record with no active connection.

template<class Context>
requires requires(Context& context) { context.get_executor(); }
explicit
tcp_stream(Context& context);

Constructs an authority record with no active connection.

template<class Allocator>
tcp_stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    executor_type executor);

Constructs an authority record with no active connection.

template<
    class Allocator,
    class Context>
requires requires(Context& context) { context.get_executor(); }
tcp_stream(
    std::allocator_arg_t tag,
    Allocator const& allocator,
    Context& context);

Template Parameters

Name Description

Context

Execution context providing get_executor().

Allocator

Allocator used for owned state and variable-sized stream storage.

Parameters

Name Description

other

Stream whose state and operation ownership are transferred.

executor

Executor used to post asynchronous completions.

context

Execution context owning the stream executor.

allocator

Allocator retained for stream-owned storage.

tag

Selects the allocator-aware constructor.

webcpp::beast::tcp_stream::tcp_stream

Disables copying of stream ownership.

Synopsis

tcp_stream(tcp_stream const&) = delete;

webcpp::beast::tcp_stream::tcp_stream

Transfers the stream and its pending operation ownership.

Synopsis

tcp_stream(tcp_stream&& other) noexcept;

Parameters

Name Description

other

Stream whose state and operation ownership are transferred.

webcpp::beast::tcp_stream::tcp_stream

Constructs an authority record with no active connection.

Synopsis

explicit
tcp_stream(executor_type executor);

Parameters

Name Description

executor

Executor used to post asynchronous completions.

webcpp::beast::tcp_stream::tcp_stream

Constructs an authority record with no active connection.

Synopsis

template<class Context>
requires requires(Context& context) { context.get_executor(); }
explicit
tcp_stream(Context& context);

Template Parameters

Name Description

Context

Execution context providing get_executor().

Parameters

Name Description

context

Execution context owning the stream executor.

webcpp::beast::tcp_stream::tcp_stream

Constructs an authority record with no active connection.

Synopsis

template<class Allocator>
tcp_stream(
    std::allocator_arg_t,
    Allocator const& allocator,
    executor_type executor);

Template Parameters

Name Description

Allocator

Allocator used for owned state and variable-sized stream storage.

Parameters

Name Description

allocator

Allocator retained for stream-owned storage.

executor

Executor used to post asynchronous completions.

webcpp::beast::tcp_stream::tcp_stream

Constructs an authority record with no active connection.

Synopsis

template<
    class Allocator,
    class Context>
requires requires(Context& context) { context.get_executor(); }
tcp_stream(
    std::allocator_arg_t tag,
    Allocator const& allocator,
    Context& context);

Template Parameters

Name Description

Allocator

Allocator used for owned state and variable-sized stream storage.

Context

Execution context providing get_executor().

Parameters

Name Description

tag

Selects the allocator-aware constructor.

allocator

Allocator retained for stream-owned storage.

context

Execution context owning the stream executor.

webcpp::beast::tcp_stream::~tcp_stream

Aborts pending host operations and releases browser registrations.

Synopsis

~tcp_stream();

webcpp::beast::tcp_stream::operator=

Disables assignment of stream ownership.

Synopses

Disables assignment of stream ownership.

tcp_stream&
operator=(tcp_stream const&) = delete;

Disables assignment of stream ownership.

webcpp::beast::tcp_stream::operator=

Disables assignment of stream ownership.

Synopsis

tcp_stream&
operator=(tcp_stream const&) = delete;

webcpp::beast::tcp_stream::operator=

Disables assignment of stream ownership.

Synopsis

tcp_stream&
operator=(tcp_stream&&) = delete;

webcpp::beast::tcp_stream::async_connect

Records the destination authority and posts the result.

Synopses

Records the destination authority and posts the result.

template<class Token>
auto
async_connect(
    endpoint_type const& endpoint,
    Token&& token);

Records the destination authority and posts the result.

template<class Token>
auto
async_connect(
    webcpp::asio::ip::tcp::resolver::results_type const& results,
    Token&& token);

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

endpoint

Address and port to record as the destination.

token

Completion token controlling handler construction and the return type.

results

Resolver results supplying the original hostname and service.

webcpp::beast::tcp_stream::async_connect

Records the destination authority and posts the result.

Synopsis

template<class Token>
auto
async_connect(
    endpoint_type const& endpoint,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

endpoint

Address and port to record as the destination.

token

Completion token controlling handler construction and the return type.

webcpp::beast::tcp_stream::async_connect

Records the destination authority and posts the result.

Synopsis

template<class Token>
auto
async_connect(
    webcpp::asio::ip::tcp::resolver::results_type const& results,
    Token&& token);

Description

The completion is posted through the associated executor and allocator. The completion signature is void(error_code, endpoint_type).

Return Value

The result determined by the completion token.

Template Parameters

Name Description

Token

Asio completion token selecting the asynchronous result type.

Parameters

Name Description

results

Resolver results supplying the original hostname and service.

token

Completion token controlling handler construction and the return type.

webcpp::beast::tcp_stream::authority_matches

Checks a hostname or host-and-port against the recorded authority.

Synopsis

[[nodiscard]]
bool
authority_matches(std::string_view host) const;

Return Value

True if the value names the recorded destination.

Note

The return value should not be discarded.

Parameters

Name Description

host

Hostname to match against the recorded destination authority.

webcpp::beast::tcp_stream::bind

Connects host cancellation and closure to the authority record.

Synopsis

void
bind(
    void* owner,
    void(* cancel)(void*),
    void(* close)(void*));

Parameters

Name Description

owner

Object retained by the host operation owner.

cancel

Callback invoked to cancel the active host operation.

close

Callback invoked to close the active host operation.

webcpp::beast::tcp_stream::cancel

cancel overloads

Synopses

Cancels the active host operation and posts its aborted completion.

void
cancel();

Cancels the active host operation and posts its aborted completion.

void
cancel(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::cancel

Cancels the active host operation and posts its aborted completion.

Synopsis

void
cancel();

webcpp::beast::tcp_stream::cancel

Cancels the active host operation and posts its aborted completion.

Synopsis

void
cancel(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::close

close overloads

Synopses

Closes the authority record and aborts its active host operation.

void
close();

Closes the authority record and aborts its active host operation.

void
close(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::close

Closes the authority record and aborts its active host operation.

Synopsis

void
close();

webcpp::beast::tcp_stream::close

Closes the authority record and aborts its active host operation.

Synopsis

void
close(boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::connect

Records the destination authority without opening a raw TCP connection.

Synopses

Records the destination authority without opening a raw TCP connection.

void
connect(endpoint_type const& endpoint);

Records the destination authority without opening a raw TCP connection.

endpoint_type
connect(webcpp::asio::ip::tcp::resolver::results_type const& results);

Records the destination authority without opening a raw TCP connection.

endpoint_type
connect(
    endpoint_type const& endpoint,
    boost::system::error_code& ec);

Records the destination authority without opening a raw TCP connection.

endpoint_type
connect(
    webcpp::asio::ip::tcp::resolver::results_type const& results,
    boost::system::error_code& ec);

Return Value

The endpoint corresponding to the recorded authority, or an empty endpoint on failure.

Parameters

Name Description

endpoint

Address and port to record as the destination.

results

Resolver results supplying the original hostname and service.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::connect

Records the destination authority without opening a raw TCP connection.

Synopsis

void
connect(endpoint_type const& endpoint);

Parameters

Name Description

endpoint

Address and port to record as the destination.

webcpp::beast::tcp_stream::connect

Records the destination authority without opening a raw TCP connection.

Synopsis

endpoint_type
connect(webcpp::asio::ip::tcp::resolver::results_type const& results);

Return Value

The endpoint corresponding to the recorded authority, or an empty endpoint on failure.

Parameters

Name Description

results

Resolver results supplying the original hostname and service.

webcpp::beast::tcp_stream::connect

Records the destination authority without opening a raw TCP connection.

Synopsis

endpoint_type
connect(
    endpoint_type const& endpoint,
    boost::system::error_code& ec);

Return Value

The endpoint corresponding to the recorded authority, or an empty endpoint on failure.

Parameters

Name Description

endpoint

Address and port to record as the destination.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::connect

Records the destination authority without opening a raw TCP connection.

Synopsis

endpoint_type
connect(
    webcpp::asio::ip::tcp::resolver::results_type const& results,
    boost::system::error_code& ec);

Return Value

The endpoint corresponding to the recorded authority, or an empty endpoint on failure.

Parameters

Name Description

results

Resolver results supplying the original hostname and service.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::expires_after

Sets an absolute deadline relative to the current steady-clock time.

Synopsis

template<
    class Rep,
    class Period>
void
expires_after(std::chrono::duration<Rep, Period> duration);

Template Parameters

Name Description

Rep

Representation type of the duration count.

Period

Tick period of the duration.

Parameters

Name Description

duration

Time remaining until the deadline.

webcpp::beast::tcp_stream::expires_at

Sets the deadline for subsequent browser operations.

Synopsis

void
expires_at(/* implementation-defined */::time_point time);

Parameters

Name Description

time

Absolute steady-clock deadline.

webcpp::beast::tcp_stream::expires_never

Disables the authority record deadline.

Synopsis

void
expires_never();

webcpp::beast::tcp_stream::expiry

Returns the deadline recorded for browser operations.

Synopsis

[[nodiscard]]
auto
expiry() const noexcept;

Return Value

The recorded deadline, or time_point::max() when disabled.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::get_executor

Returns the executor used for asynchronous completions.

Synopsis

[[nodiscard]]
executor_type
get_executor() const noexcept;

Return Value

The executor associated with the underlying context.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::host

Returns the recorded hostname or bracketed IPv6 address.

Synopsis

[[nodiscard]]
std::string_view
host() const noexcept;

Return Value

The hostname or bracketed IPv6 address.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::is_open

Reports whether a connection authority has been recorded.

Synopsis

[[nodiscard]]
bool
is_open() const noexcept;

Return Value

True when the layer is available for operations.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::port

Returns the recorded service port.

Synopsis

[[nodiscard]]
uint16_t
port() const noexcept;

Return Value

The recorded service port.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::resource

Returns the allocation resource retained by this stream.

Synopsis

[[nodiscard]]
std::pmr::memory_resource*
resource() const noexcept;

Return Value

The stream-owned resource; its lifetime is tied to retained resource ownership.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::resource_owner

Returns shared ownership of the stream allocation resource.

Synopsis

[[nodiscard]]
std::shared_ptr<std::pmr::memory_resource> const&
resource_owner() const noexcept;

Return Value

Shared ownership of the stream allocation resource.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::response_body_limit

response_body_limit overloads

Synopses

Returns the maximum decoded fetch body size in bytes.

[[nodiscard]]
std::size_t
response_body_limit() const noexcept;

Sets the maximum decoded fetch body size in bytes.

void
response_body_limit(std::size_t value) noexcept;

Return Value

The maximum decoded body size in bytes.

Parameters

Name Description

value

Maximum decoded response bytes; the default is 8 MiB.

webcpp::beast::tcp_stream::response_body_limit

Returns the maximum decoded fetch body size in bytes.

Synopsis

[[nodiscard]]
std::size_t
response_body_limit() const noexcept;

Return Value

The maximum decoded body size in bytes.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::response_body_limit

Sets the maximum decoded fetch body size in bytes.

Synopsis

void
response_body_limit(std::size_t value) noexcept;

Parameters

Name Description

value

Maximum decoded response bytes; the default is 8 MiB.

webcpp::beast::tcp_stream::secure

secure overloads

Synopses

Reports whether browser URLs use TLS.

[[nodiscard]]
bool
secure() const noexcept;

Records whether browser URLs use TLS.

void
secure(bool value) noexcept;

Return Value

True when secure URL schemes are selected.

Parameters

Name Description

value

Whether subsequent URLs use https or wss.

webcpp::beast::tcp_stream::secure

Reports whether browser URLs use TLS.

Synopsis

[[nodiscard]]
bool
secure() const noexcept;

Return Value

True when secure URL schemes are selected.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::secure

Records whether browser URLs use TLS.

Synopsis

void
secure(bool value) noexcept;

Parameters

Name Description

value

Whether subsequent URLs use https or wss.

webcpp::beast::tcp_stream::shutdown

Closes the browser operation and its authority record.

Synopses

Closes the browser operation and its authority record.

void
shutdown(webcpp::asio_backend::socket_base::shutdown_type what);

Closes the browser operation and its authority record.

void
shutdown(
    webcpp::asio_backend::socket_base::shutdown_type,
    boost::system::error_code& ec);

Parameters

Name Description

what

Shutdown direction; browser host operations close as a whole.

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::shutdown

Closes the browser operation and its authority record.

Synopsis

void
shutdown(webcpp::asio_backend::socket_base::shutdown_type what);

Parameters

Name Description

what

Shutdown direction; browser host operations close as a whole.

webcpp::beast::tcp_stream::shutdown

Closes the browser operation and its authority record.

Synopsis

void
shutdown(
    webcpp::asio_backend::socket_base::shutdown_type,
    boost::system::error_code& ec);

Parameters

Name Description

ec

Receives the operation error, or is cleared on success.

webcpp::beast::tcp_stream::socket

Returns this authority record through the Beast lowest-layer interface.

Synopses

Returns this authority record through the Beast lowest-layer interface.

tcp_stream&
socket() noexcept;

Returns this authority record through the Beast lowest-layer interface.

[[nodiscard]]
tcp_stream const&
socket() const noexcept;

Return Value

A reference to this authority record.

webcpp::beast::tcp_stream::socket

Returns this authority record through the Beast lowest-layer interface.

Synopsis

tcp_stream&
socket() noexcept;

Return Value

A reference to this authority record.

webcpp::beast::tcp_stream::socket

Returns this authority record through the Beast lowest-layer interface.

Synopsis

[[nodiscard]]
tcp_stream const&
socket() const noexcept;

Return Value

A reference to this authority record.

Note

The return value should not be discarded.

webcpp::beast::tcp_stream::url

Builds a browser URL from the recorded authority and request target.

Synopsis

[[nodiscard]]
std::pmr::string
url(
    std::string_view target,
    bool websocket = false) const;

Return Value

The fully qualified browser URL.

Note

The return value should not be discarded.

Parameters

Name Description

target

Origin-form path and query for the browser URL.

websocket

Selects ws or wss instead of http or https.

webcpp::beast::tcp_stream::http_state

Shared fetch transaction storage retained by the authority record.

Synopsis

std::shared_ptr<void> http_state;

webcpp::beast::browser_errc

Browser failures without a corresponding Beast or Asio error.

Synopsis

enum class browser_errc : int;

Members

Name Description

invalid_url

The browser rejected a URL or WebSocket subprotocol syntax.

blocked

Browser security policy blocked the operation.

connection_failed

The browser could not establish the WebSocket connection.

send_limit

The outgoing WebSocket queue exceeded its configured bound.

receive_limit

Unread WebSocket messages exceeded their configured queue bound.

fetch_failed

Fetch failed without an exposed cause, including network and CORS failures.

no_host

The operation has no usable recorded destination authority.

webcpp::beast::browser_category

Returns the stable browser error category.

Synopsis

boost::system::error_category const&
browser_category() noexcept;

Return Value

The process-lifetime browser error category.

webcpp::beast::make_error_code

Converts a browser failure into its stable error-code representation.

Synopsis

boost::system::error_code
make_error_code(browser_errc code) noexcept;

Return Value

The code associated with browser_category().

Parameters

Name Description

code

Browser error enumerator.

webcpp::beast::set_server_name

Records the requested TLS server name for authority validation.

Synopsis

template<class NextLayer>
boost::system::result<void>
set_server_name(
    ssl_stream<NextLayer>& stream,
    std::string_view host);

Return Value

Success, or invalid_argument for an invalid server-name record.

Template Parameters

Name Description

NextLayer

Underlying browser authority or TLS-intent layer.

Parameters

Name Description

stream

Browser stream whose recorded authority selects the host operation.

host

Hostname to match against the recorded destination authority.

webcpp::beast::basic_flat_buffer

Upstream contiguous dynamic buffer with an application-supplied allocator.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::basic_flat_buffer;

webcpp::beast::basic_multi_buffer

Upstream segmented dynamic buffer with an application-supplied allocator.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::basic_multi_buffer;

webcpp::beast::bind_front_handler

Binds leading arguments to a completion handler.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::bind_front_handler;

webcpp::beast::buffers_prefix

Returns a view of the first bytes of a buffer sequence.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::buffers_prefix;

webcpp::beast::buffers_to_string

Copies a buffer sequence to a string.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::buffers_to_string;

webcpp::beast::error

Upstream common stream errors, including timeout.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::error;

webcpp::beast::error_code

The error-code type used by Beast operations.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::error_code;

webcpp::beast::file_mode

Upstream file-opening modes for explicit file bodies.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::file_mode;

webcpp::beast::flat_buffer

Upstream contiguous dynamic buffer.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::flat_buffer;

webcpp::beast::flat_static_buffer

Upstream contiguous buffer with fixed capacity.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::flat_static_buffer;

webcpp::beast::get_lowest_layer

Finds the innermost layer of a composed stream.

Synopsis

using webcpp::beast_backend::get_lowest_layer;

webcpp::beast::iequals

Compares strings with HTTP’s ASCII case-insensitive rules.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::iequals;

webcpp::beast::make_printable

Formats a buffer sequence for diagnostic output.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::make_printable;

webcpp::beast::multi_buffer

Upstream segmented dynamic buffer.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::multi_buffer;

webcpp::beast::ostream

Creates an output stream that appends to a dynamic buffer.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::ostream;

webcpp::beast::role_type

Client or server role used by protocol options.

Synopsis

using webcpp::beast_backend::role_type;

webcpp::beast::static_buffer

Upstream fixed-capacity buffer.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::static_buffer;

webcpp::beast::string_view

Upstream non-owning string view.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::string_view;

webcpp::beast::system_error

Upstream exception type for explicitly throwing application code.

Synopsis

Declared in <webcpp/beast/core.hpp>

using webcpp::beast_backend::system_error;

WEBCPP_BEAST_BACKEND_HEADER

Selects a protocol implementation header for internal use.

Synopsis

#define WEBCPP_BEAST_BACKEND_HEADER(header)

Parameters

Name Description

header

The path relative to the backend include root.

WEBCPP_BEAST_HAS_OPENSSL_BACKEND

1 when guest OpenSSL can be linked on the selected target; does not link it.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_HAS_OPENSSL_BACKEND

WEBCPP_BEAST_HAS_SOCKET_BACKEND

1 when the selected Asio backend supplies native or WASI guest sockets.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_HAS_SOCKET_BACKEND

WEBCPP_BEAST_NO_EXCEPTIONS

Records the facade’s exception policy for host-adapter implementations.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_NO_EXCEPTIONS

Description

Defined automatically when webcpp has no exceptions, or explicitly by the application. Host adapters report recoverable failures through error codes. Inherited upstream overloads and data types retain Boost’s own exception configuration.

WEBCPP_BEAST_UNSUPPORTED_ERROR

Reports unsupported host operations as errors, the default policy.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_UNSUPPORTED_ERROR

WEBCPP_BEAST_UNSUPPORTED_ERROR

Reports unsupported host operations as errors, the default policy.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_UNSUPPORTED_ERROR

WEBCPP_BEAST_UNSUPPORTED_IGNORE

Allows documented unsupported settings to be ignored by host adapters.

Synopsis

Declared in <webcpp/beast/config.hpp>

#define WEBCPP_BEAST_UNSUPPORTED_IGNORE

WEBCPP_BEAST_WASI_HTTP_EXPORT

Exports the P2 host server.

Synopsis

#define WEBCPP_BEAST_WASI_HTTP_EXPORT(handler)

Parameters

Name Description

handler

Callable building a response or variant for one request.

Appendix A: Changelog

Changes to the unreleased Beast facade.

Unreleased

  • Fixed browser HTTP and WebSocket transfers with shared Wasm memory.

  • Added current application coverage and shared Release parser measurements.

webcpp 0.1.0

  • Added portable HTTP data interfaces and native/WASIp3 socket operations.

  • Added optional guest TLS SNI configuration with hostname validation.

  • Added browser WebSocket and fetch adapters with explicit capability policies.

  • Added WASI host HTTP and supplied-stream application counterparts.

  • Fixed WebSocket executor conversion when per-message compression is disabled.

  • Fixed host completion storage lifetime and support for PMR operation allocators.

  • Fixed supplied-stream HTTP reads with small bounded buffers.

  • Added executable examples, API reference and a verified target matrix.