]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/docs/api/mg_websocket_write.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_websocket_write.md
1 # Civetweb API Reference
2
3 ### `mg_websocket_write( conn, opcode, data, data_len );`
4
5 ### Parameters
6
7 | Parameter | Type | Description |
8 | :--- | :--- | :--- |
9 |**`conn`**|`struct mg_connection *`|Connection on which the data must be written|
10 |**`opcode`**|`int`|Opcode|
11 |**`data`**|`const char *`|Data to be written to the client|
12 |**`data_len`**|`size_t`|Length of the data|
13
14 ### Return Value
15
16 | Type | Description |
17 | :--- | :--- |
18 |`int`|Number of bytes written or an error code|
19
20 ### Description
21
22 The function `mg_websocket_write()` sends data to a websocket client wrapped in a websocket frame. The function issues calls to [`mg_lock_connection()`](mg_lock_connection.md) and [`mg_unlock_connection()`](mg_unlock_connection.md) to ensure that the transmission is not interrupted. Data corruption can otherwise happen if the application is proactively communicating and responding to a request simultaneously.
23
24 The function is available only when Civetweb is compiled with the `-DUSE_WEBSOCKET` option.
25
26 The function returns the number of bytes written, **0** when the connection has been closed and **-1** if an error occurred.
27
28 ### See Also
29
30 * [`mg_lock_connection();`](mg_lock_connection.md)
31 * [`mg_printf();`](mg_printf.md)
32 * [`mg_unlock_connection();`](mg_unlock_connection.md)
33 * [`mg_websocket_client_write();`](mg_websocket_client_write.md)
34 * [`mg_write();`](mg_write.md)