Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
libcurl-ws(3) | Library Functions Manual | libcurl-ws(3) |
NAME
libcurl-ws - WebSocket interface overviewDESCRIPTION
The WebSocket interface provides functions for receiving and sending WebSocket data.INCLUDE
You still only include <curl/curl.h> in your code.SETUP
WebSocket is also often known as WebSockets, in plural. It is done by upgrading a regular HTTP(S) GET request to a WebSocket connection.MESSAGES
WebSocket communication is message based. That means that both ends send and receive entire messages, not streams like TCP. A WebSocket message is sent over the wire in one or more frames. Each frame in a message can have a size up to 2^63 bytes.Raw mode
libcurl can be told to speak WebSocket in "raw mode" by setting the CURLWS_RAW_MODE bit to the CURLOPT_WS_OPTIONS(3) option.PING
WebSocket is designed to allow long-lived sessions and in order to keep the connections alive, both ends can send PING messages for the other end to respond with a PONG.MODELS
Because of the many different ways WebSocket can be used, which is much more flexible than limited to plain downloads or uploads, libcurl offers two different API models to use it:Callback model
When a write callback is set and a WebSocket transfer is performed, the callback is called to deliver all WebSocket data that arrives.CONNECT_ONLY model
By setting CURLOPT_CONNECT_ONLY(3) to 2L, the transfer only establishes and setups the WebSocket communication and then returns control back to the application.EXPERIMENTAL
The WebSocket API was introduced as experimental in 7.86.0 and is still experimental today.SEE ALSO
CURLOPT_CONNECT_ONLY(3), CURLOPT_WRITEFUNCTION(3), CURLOPT_WS_OPTIONS(3), curl_easy_init(3), curl_ws_meta(3), curl_ws_recv(3), curl_ws_send(3)2024-11-21 | libcurl |