EasyManua.ls Logo

Espressif ESP32-S2 - Page 656

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
session. It is the opposite of the esp_websocket_client_init function and must be called with the same handle
as input that a esp_websocket_client_init call returned. This might close all connections this handle has used.
Notes:
Cannot be called from the websocket event handler
Return esp_err_t
Parameters
[in] client: The client
int esp_websocket_client_send(esp_websocket_client_handle_t client, const char *data, int len,
TickType_t timeout)
Generic write data to the WebSocket connection; defaults to binary send.
Return
Number of data was sent
(-1) if any errors
Parameters
[in] client: The client
[in] data: The data
[in] len: The length
[in] timeout: Write data timeout in RTOS ticks
int esp_websocket_client_send_bin(esp_websocket_client_handle_t client, const char *data, int
len, TickType_t timeout)
Write binary data to the WebSocket connection (data send with WS OPCODE=02, i.e. binary)
Return
Number of data was sent
(-1) if any errors
Parameters
[in] client: The client
[in] data: The data
[in] len: The length
[in] timeout: Write data timeout in RTOS ticks
int esp_websocket_client_send_text(esp_websocket_client_handle_t client, const char *data,
int len, TickType_t timeout)
Write textual data to the WebSocket connection (data send with WS OPCODE=01, i.e. text)
Return
Number of data was sent
(-1) if any errors
Parameters
[in] client: The client
[in] data: The data
[in] len: The length
[in] timeout: Write data timeout in RTOS ticks
esp_err_t esp_websocket_client_close(esp_websocket_client_handle_t client, TickType_t time-
out)
Close the WebSocket connection in a clean way.
Sequence of clean close initiated by client:
Client sends CLOSE frame
Client waits until server echos the CLOSE frame
Client waits until server closes the connection
Client is stopped the same way as by the esp_websocket_client_stop()
Notes:
Cannot be called from the websocket event handler
Return esp_err_t
Parameters
Espressif Systems 645
Submit Document Feedback
Release v4.4

Table of Contents