]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/docs/api/mg_set_websocket_handler_with_subprotocols.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / docs / api / mg_set_websocket_handler_with_subprotocols.md
CommitLineData
1e59de90
TL
1# Civetweb API Reference
2
3### `mg_set_websocket_handler_with_subprotocols( ctx, uri, subprotocols, connect_handler, ready_handler, data_handler, close_handler, cbdata );`
4
5### Parameters
6
7| Parameter | Type | Description |
8| :--- | :--- | :--- |
9|**`ctx`**|`mg_context *`|The context in which to add the handlers|
10|**`uri`**|`const char *`|The URI for which the handlers should be activated|
11|**`subprotocols`**|`struct mg_websocket_subprotocols *`|A list of supported sub-protocols|
12|**`connect_handler`**|`mg_websocket_connect_handler`|Handler called when a connect is signaled|
13|**`ready_handler`**|`mg_websocket_ready_handler`|Handler called when the connection is ready|
14|**`data_handler`**|`mg_websocket_data_handler`|Handler called when data is received|
15|**`close_handler`**|`mg_websocket_close_handler`|Handler called when the connection closes|
16|**`cbdata`**|`void *`|User defined data|
17
18`int mg_websocket_connect_handler( const struct mg_connection *conn, void *cbdata );`
19`int mg_websocket_ready_handler( struct mg_connection *conn, void *cbdata );`
20`int mg_websocket_data_handler( struct mg_connection *conn, int opcode, char * buf, size_t buf_len, void *cbdata );`
21`int mg_websocket_close_handler( const struct mg_connection *conn, void *cbdata );`
22
23### Return Value
24
25*none*
26
27### Description
28
29The function `mg_set_websocket_handler_with_subprotocols()` connects callback functions to a websocket URI, just like [`mg_set_websocket_handler();`](mg_set_websocket_handler.md).
30In addition, it allows to specify websocket sub-protocols.
31The callback functions are called when a state change is detected on the URI like an incoming connection or data received from a remote peer.
32
33### See Also
34
35* [`struct mg_websocket_subprotocols;`](api/mg_websocket_subprotocols.md)
36* [`mg_set_websocket_handler();`](mg_set_websocket_handler.md)