2022-09-09 21:11:14 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\" * _ _ ____ _
|
|
|
|
.\" * Project ___| | | | _ \| |
|
|
|
|
.\" * / __| | | | |_) | |
|
|
|
|
.\" * | (__| |_| | _ <| |___
|
|
|
|
.\" * \___|\___/|_| \_\_____|
|
|
|
|
.\" *
|
|
|
|
.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
|
|
.\" * you should have received as part of this distribution. The terms
|
|
|
|
.\" * are also available at https://curl.se/docs/copyright.html.
|
|
|
|
.\" *
|
|
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
.\" * KIND, either express or implied.
|
|
|
|
.\" *
|
|
|
|
.\" * SPDX-License-Identifier: curl
|
|
|
|
.\" *
|
|
|
|
.\" **************************************************************************
|
|
|
|
.\"
|
|
|
|
.TH curl_ws_send 3 "12 Jun 2022" "libcurl 7.85.0" "libcurl Manual"
|
|
|
|
.SH NAME
|
2022-10-03 23:40:02 +08:00
|
|
|
curl_ws_send - send WebSocket data
|
2022-09-09 21:11:14 +08:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
#include <curl/easy.h>
|
|
|
|
|
2022-09-11 05:36:49 +08:00
|
|
|
CURLcode curl_ws_send(CURL *curl, const void *buffer, size_t buflen,
|
2022-10-03 23:40:02 +08:00
|
|
|
size_t *sent, curl_off_t framesize,
|
|
|
|
unsigned int flags);
|
2022-09-09 21:11:14 +08:00
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
This function call is EXPERIMENTAL.
|
|
|
|
|
2022-10-03 23:40:02 +08:00
|
|
|
Send the specific message fragment over an established WebSocket
|
|
|
|
connection. The \fIbuffer\fP holds the data to send and it is \fIbuflen\fP
|
|
|
|
number of payload bytes in that memory area.
|
|
|
|
|
|
|
|
\fIsent\fP is returned as the number of payload bytes actually sent.
|
|
|
|
|
|
|
|
To send a (huge) fragment using multiple calls with partial content per
|
|
|
|
invoke, set the \fICURLWS_OFFSET\fP bit and the \fIframesize\fP argument as
|
|
|
|
the total expected size for the first part, then set the \fICURLWS_OFFSET\fP
|
|
|
|
with a zero \fItotalsize\fP for the following parts.
|
|
|
|
|
|
|
|
If not sending a partial fragment or if this is raw mode, \fIframsize\fP
|
|
|
|
should be set to zero.
|
2022-09-09 21:11:14 +08:00
|
|
|
|
|
|
|
If \fBCURLWS_RAW_MODE\fP is enabled in \fICURLOPT_WS_OPTIONS(3)\fP, the
|
2022-09-21 05:30:19 +08:00
|
|
|
\fBflags\fP argument should be set to 0.
|
2022-09-09 21:11:14 +08:00
|
|
|
|
2022-09-21 05:30:19 +08:00
|
|
|
.SH FLAGS
|
2022-09-09 21:11:14 +08:00
|
|
|
.IP CURLWS_TEXT
|
2022-09-13 15:17:53 +08:00
|
|
|
The buffer contains text data. Note that this makes a difference to WebSocket
|
2022-09-09 21:11:14 +08:00
|
|
|
but libcurl itself will not make any verification of the content or
|
|
|
|
precautions that you actually send valid UTF-8 content.
|
|
|
|
.IP CURLWS_BINARY
|
|
|
|
This is binary data.
|
|
|
|
.IP CURLWS_CONT
|
|
|
|
This is not the final fragment of the message, which implies that there will
|
|
|
|
be another fragment coming as part of the same message where this bit is not
|
|
|
|
set.
|
|
|
|
.IP CURLWS_CLOSE
|
|
|
|
Close this transfer.
|
|
|
|
.IP CURLWS_PING
|
|
|
|
This as a ping.
|
|
|
|
.IP CURLWS_PONG
|
|
|
|
This as a pong.
|
2022-10-03 23:40:02 +08:00
|
|
|
.IP CURLWS_OFFSET
|
|
|
|
The provided data is only a partial fragment and there will be more in a
|
|
|
|
following call to \fIcurl_ws_send()\fP. When sending only a piece of the
|
|
|
|
fragment like this, the \fIframesize\fP must be provided with the total
|
|
|
|
expected frame size in the first call and it needs to be zero in subsequent
|
|
|
|
calls.
|
2022-09-09 21:11:14 +08:00
|
|
|
.SH EXAMPLE
|
|
|
|
.nf
|
|
|
|
|
|
|
|
.fi
|
|
|
|
.SH AVAILABILITY
|
2022-09-09 21:36:06 +08:00
|
|
|
Added in 7.86.0.
|
2022-09-09 21:11:14 +08:00
|
|
|
.SH RETURN VALUE
|
|
|
|
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR curl_easy_setopt "(3), " curl_easy_perform "(3), "
|
|
|
|
.BR curl_easy_getinfo "(3), "
|
|
|
|
.BR curl_ws_recv "(3) "
|