1curl_ws_send(3)                 libcurl Manual                 curl_ws_send(3)
2
3
4

NAME

6       curl_ws_send - send WebSocket data
7

SYNOPSIS

9       #include <curl/easy.h>
10
11       CURLcode curl_ws_send(CURL *curl, const void *buffer, size_t buflen,
12                             size_t *sent, curl_off_t fragsize,
13                             unsigned int flags);
14

DESCRIPTION

16       This function call is EXPERIMENTAL.
17
18       Send  the  specific message fragment over an established WebSocket con‐
19       nection. The buffer holds the data to send and it is buflen  number  of
20       payload bytes in that memory area.
21
22       sent is returned as the number of payload bytes actually sent.
23
24       To send a (huge) fragment using multiple calls with partial content per
25       invoke, set the CURLWS_OFFSET bit and the fragsize argument as the  to‐
26       tal expected size for the first part, then set the CURLWS_OFFSET with a
27       zero fragsize for the following parts.
28
29       If not sending a partial fragment or if  this  is  raw  mode,  fragsize
30       should be set to zero.
31
32       If CURLWS_RAW_MODE is enabled in CURLOPT_WS_OPTIONS(3), the flags argu‐
33       ment should be set to 0.
34
35       To send a message consisting of multiple frames,  set  the  CURLWS_CONT
36       bit in all frames except the final one.
37

FLAGS

39       CURLWS_TEXT
40              The buffer contains text data. Note that this makes a difference
41              to WebSocket but libcurl itself will not make  any  verification
42              of the content or precautions that you actually send valid UTF-8
43              content.
44
45       CURLWS_BINARY
46              This is binary data.
47
48       CURLWS_CONT
49              This is not the final fragment of  the  message,  which  implies
50              that  there  will be another fragment coming as part of the same
51              message where this bit is not set.
52
53       CURLWS_CLOSE
54              Close this transfer.
55
56       CURLWS_PING
57              This is a ping.
58
59       CURLWS_PONG
60              This is a pong.
61
62       CURLWS_OFFSET
63              The provided data is only a partial fragment and there  will  be
64              more  in a following call to curl_ws_send(). When sending only a
65              piece of the fragment like this, the fragsize must  be  provided
66              with  the  total expected fragment size in the first call and it
67              needs to be zero in subsequent calls.
68

EXAMPLE

AVAILABILITY

71       Added in 7.86.0.
72

RETURN VALUE

SEE ALSO

75       curl_easy_setopt(3),    curl_easy_perform(3),     curl_easy_getinfo(3),
76       curl_ws_recv(3)
77
78
79
80libcurl 8.0.1                  February 06, 2023               curl_ws_send(3)
Impressum