Chapter 2. API Reference
Public Members
uint16_t start_offset
Modbus start address for area descriptor
mb_param_type_t type
Type of storage area descriptor
void *address
Instance address for storage area descriptor
size_t size
Instance size for area descriptor (bytes)
2.3.12 ESP WebSocket Client
Overview
The ESP WebSocket client is an implementation of WebSocket protocol client for ESP32-S2
Features
• Supports WebSocket over TCP, TLS with mbedtls
• Easy to setup with URI
• Multiple instances (Multiple clients in one application)
Configuration
URI
• Supports ws, wss schemes
• WebSocket samples:
– ws://echo.websocket.org: WebSocket over TCP, default port 80
– wss://echo.websocket.org: WebSocket over SSL, default port 443
Minimal configurations:
const esp_websocket_client_config_t ws_cfg = {
.uri = "ws://echo.websocket.org",
};
The WebSocket client supports the use of both path and query in the URI. Sample:
const esp_websocket_client_config_t ws_cfg = {
.uri = "ws://echo.websocket.org/connectionhandler?id=104",
};
If there are any options related to the URI in esp_websocket_client_config_t, the option defined by the
URI will be overridden. Sample:
const esp_websocket_client_config_t ws_cfg = {
.uri = "ws://echo.websocket.org:123",
.port = 4567,
};
//WebSocket client will connect to websocket.org using port 4567
Espressif Systems 642
Submit Document Feedback
Release v4.4