|
| 1 | +.\" ************************************************************************** |
| 2 | +.\" * _ _ ____ _ |
| 3 | +.\" * Project ___| | | | _ \| | |
| 4 | +.\" * / __| | | | |_) | | |
| 5 | +.\" * | (__| |_| | _ <| |___ |
| 6 | +.\" * \___|\___/|_| \_\_____| |
| 7 | +.\" * |
| 8 | +.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. |
| 9 | +.\" * |
| 10 | +.\" * This software is licensed as described in the file COPYING, which |
| 11 | +.\" * you should have received as part of this distribution. The terms |
| 12 | +.\" * are also available at https://curl.se/docs/copyright.html. |
| 13 | +.\" * |
| 14 | +.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 | +.\" * copies of the Software, and permit persons to whom the Software is |
| 16 | +.\" * furnished to do so, under the terms of the COPYING file. |
| 17 | +.\" * |
| 18 | +.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | +.\" * KIND, either express or implied. |
| 20 | +.\" * |
| 21 | +.\" * SPDX-License-Identifier: curl |
| 22 | +.\" * |
| 23 | +.\" ************************************************************************** |
| 24 | +.\" |
| 25 | +.TH CURLOPT_WS_OPTIONS 3 "10 Jun 2022" "libcurl 7.85.0" "curl_easy_setopt options" |
| 26 | +.SH NAME |
| 27 | +CURLOPT_WS_OPTIONS \- WebSockets behavior options |
| 28 | +.SH SYNOPSIS |
| 29 | +.nf |
| 30 | +#include <curl/curl.h> |
| 31 | + |
| 32 | +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WS_OPTIONS, long bitmask); |
| 33 | +.fi |
| 34 | +.SH DESCRIPTION |
| 35 | +Pass a long with a bitmask to tell libcurl about specific WebSockets |
| 36 | +behaviors. |
| 37 | + |
| 38 | +To "detatch" a websockets connection and use the \fIcurl_ws_send(3)\fP and |
| 39 | +\fIcurl_ws_recv(3)\fP functions after the HTTP upgrade procedure, set the |
| 40 | +\fICURLOPT_CONNECT_ONLY(3)\fP option to 2L. |
| 41 | + |
| 42 | +Available bits in the bitmask |
| 43 | +.IP "CURLWS_RAW_MODE (1)" |
| 44 | +Deliver "raw" websockets traffic to the \fICURLOPT_WRITEFUNCTION(3)\fP |
| 45 | +callback. |
| 46 | + |
| 47 | +In raw mode, libcurl does not handle pings or any other frame for the |
| 48 | +application. |
| 49 | +.IP "CURLWS_COMPRESS_MODE (2)" |
| 50 | +Negotiate compression for this transfer. (NOT IMPLEMENTED YET) |
| 51 | +.IP "CURLWS_PINGOFF_MODE (4)" |
| 52 | +Disable automated ping/pong handling. (NOT IMPLEMENTED YET) |
| 53 | +.SH DEFAULT |
| 54 | +0 |
| 55 | +.SH PROTOCOLS |
| 56 | +WebSockets |
| 57 | +.SH EXAMPLE |
| 58 | +.nf |
| 59 | +CURL *curl = curl_easy_init(); |
| 60 | +if(curl) { |
| 61 | + curl_easy_setopt(curl, CURLOPT_URL, "ws://example.com/"); |
| 62 | + /* use the stand alone API */ |
| 63 | + curl_easy_setopt(curl, CURLOPT_WS_OPTIONS, CURLWS_ALONE); |
| 64 | + ret = curl_easy_perform(curl); |
| 65 | + curl_easy_cleanup(curl); |
| 66 | +} |
| 67 | +.fi |
| 68 | +.SH AVAILABILITY |
| 69 | +Added in 7.85.0 |
| 70 | +.SH RETURN VALUE |
| 71 | +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. |
| 72 | +.SH "SEE ALSO" |
| 73 | +.BR curl_ws_recv "(3), " curl_ws_send "(3), " |
0 commit comments