DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ws_client.h File Reference

Zero-heap outbound WebSocket client, RFC 6455 (DETWS_ENABLE_WS_CLIENT). More...

#include "ServerConfig.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Detailed Description

Zero-heap outbound WebSocket client, RFC 6455 (DETWS_ENABLE_WS_CLIENT).

Connects to a remote WebSocket endpoint (ws://, or wss:// over client-side mbedTLS) and exchanges text/binary messages - the device as a WebSocket client to a cloud dashboard or control plane. Split, like the other services, into a pure host-testable codec and an ESP32-only transport:

  • ws_client_build_handshake / ws_client_accept_for_key / ws_client_check_response / ws_client_build_frame / ws_client_parse_frame are pure functions, unit-tested on the host (env:native_ws_client).
  • ws_client_connect / ws_client_send_text / ws_client_loop drive the connection over raw lwIP (wss:// via the shared persistent client TLS session). No heap; one connection at a time.

Client frames are always masked (RFC 6455 §5.3); server frames are not. Only unfragmented messages that fit DETWS_WS_CLIENT_BUF_SIZE are delivered.

Definition in file ws_client.h.