summaryrefslogtreecommitdiffstats
path: root/src/civetweb/docs/api/mg_connect_websocket_client.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/docs/api/mg_connect_websocket_client.md
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/civetweb/docs/api/mg_connect_websocket_client.md')
-rw-r--r--src/civetweb/docs/api/mg_connect_websocket_client.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/civetweb/docs/api/mg_connect_websocket_client.md b/src/civetweb/docs/api/mg_connect_websocket_client.md
new file mode 100644
index 000000000..8562b25a7
--- /dev/null
+++ b/src/civetweb/docs/api/mg_connect_websocket_client.md
@@ -0,0 +1,36 @@
+# Civetweb API Reference
+
+### `mg_connect_websocket_client( host, port, use_ssl, error_buffer, error_buffer_size, path, origin, data_func, close_func, user-data);`
+
+### Parameters
+
+| Parameter | Type | Description |
+| :--- | :--- | :--- |
+|**`host`**|`const char *`|The hostname or IP address of the server|
+|**`port`**|`int`|The port on the server|
+|**`use_ssl`**|`int`|Use SSL if this parameter is not equal to zero|
+|**`error_buffer`**|`char *`|Buffer to store an error message|
+|**`error_buffer_size`**|`size_t`|Size of the error message buffer including the NUL terminator|
+|**`path`**|`const char *`|The server path to connect to, for example `/app` if you want to connect to `localhost/app`|
+|**`origin`**|`const char *`|The value of the `Origin` HTTP header|
+|**`data_func`**|`mg_websocket_data_handler`|Callback which is used to process data coming back from the server|
+|**`close_func`**|`mg_websocket_close_handler`|Callback which is called when the connection is to be closed|
+|**`user_data`**|`void *`|User supplied argument|
+
+### Return Value
+
+| Type | Description |
+| :--- | :--- |
+|`struct mg_connection *`|A pointer to the connection structure, or NULL if connecting failed|
+
+### Description
+
+The function `mg_connect_websocket_client()` connects to a websocket on a server as a client. Data and close events are processed with callback functions which must be provided in the call.
+
+Civetweb supports both IPv4 and IPv6 communication, but only if the use if IPv6 has been enabled at compile time. When running an application it is possible to check if IPv6 addressing is available by calling the [`mg_check_feature()`](mg_check_feature.md) function with the `USE_IPV6` parameter.
+
+### See Also
+
+* [`mg_check_feature();`](mg_check_feature.md)
+* [`mg_connect_client();`](mg_connect_client.md)
+* [`mg_connect_client_secure();`](mg_connect_client_secure.md)