Go to the source code of this file.
typedef void(* evwsconn_close_cb)(struct evwsconn *conn, void *user_data) |
A callback invoked when the WebSocket connection has been closed.
- Parameters
-
conn | The evwsconn that received the data |
user_data | The user-supplied pointer passed to evwsconn_set_cbs |
typedef void(* evwsconn_error_cb)(struct evwsconn *conn, void *user_data) |
A callback invoked when an unrecoverable error has occured on the WebSocket connection.
- Parameters
-
conn | The evwsconn that received the data |
user_data | The user-supplied pointer passed to evwsconn_set_cbs |
typedef void(* evwsconn_message_cb)(struct evwsconn *conn, enum evws_data_type, const unsigned char *data, int len, void *user_data) |
A callback invoked when a new message been received on the WebSocket connection
- Parameters
-
conn | The evwsconn that received the data |
data_type | The type of data received |
data | The data received |
len | The length of the data |
user_data | The user-supplied pointer passed to evwsconn_set_cbs |
Types of data in messages sent and received by a WebSocket connection
void evwsconn_free |
( |
struct evwsconn * |
conn) | |
|
Disable and deallocate an evwsconn
const char* evwsconn_get_subprotocol |
( |
struct evwsconn * |
conn) | |
|
Get the subprotocol used for this connection.
- Parameters
-
conn | The evwsconn for which to get the subprotocol |
void evwsconn_send_close |
( |
struct evwsconn * |
conn) | |
|
Send a close message to client and, once sent, close the connection.
NOTE: evwsconn_close_cb() will still be called when the connection is closed. Calling evwsconn_free() before that callback will prevent the close message from being sent as required to cleanly close a WebSocket connection.
void evwsconn_send_message |
( |
struct evwsconn * |
conn, |
|
|
enum evws_data_type |
data_type, |
|
|
const unsigned char * |
data, |
|
|
int |
len |
|
) |
| |
Send a new message on the WebSocket connection.
- Parameters
-
conn | The evwsconn on which to send the message |
data_type | The type of data to be sent |
data | The data to send |
len | The length of the data |
Sets (or changes) callbacks on a WebSocket connection.
- Parameters
-
conn | The evwsconn that received the data |
message_cb | Message (new data received) callback |
close_cb | Close callback |
error_cb | Error callback |
user_data | The user-supplied pointer passed to evwsconn_set_cbs |