curl_ws_recv - receive websocket data
curl_ws_recv - receive WebSocket data
#include <curl/curl.h> CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen, size_t *recv, const struct curl_ws_frame **meta);
This function call is EXPERIMENTAL.
Retrieves as much as possible of a received WebSocket data fragment into the buffer, but not more than buflen bytes. recv is set to the number of bytes actually stored.
If there is more fragment data to deliver than what fits in the provided buffer, libcurl returns a full buffer and the application needs to call this function again to continue draining the buffer.
The meta pointer gets set to point to a const struct curl_ws_frame that contains information about the received data. See the curl_ws_meta for details on that struct.
size_t rlen; const struct curl_ws_frame *meta; char buffer; CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
Added in 7.86.0.
Instead of blocking, the function returns CURLE_AGAIN. The correct behavior is then to wait for the socket to signal readability before calling this function again.
This HTML page was made with roffit.