Commit 464b8951 authored by Sergey Lyubka's avatar Sergey Lyubka

Added enum for websocket opcodes

parent 05d7b7c8
......@@ -2639,7 +2639,7 @@ static void send_websocket_handshake_if_requested(struct mg_connection *conn) {
static void ping_idle_websocket_connection(struct connection *conn, time_t t) {
if (t - conn->ns_conn->last_io_time > MONGOOSE_USE_WEBSOCKET_PING_INTERVAL) {
mg_websocket_write(&conn->mg_conn, 0x9, "", 0);
mg_websocket_write(&conn->mg_conn, WEBSOCKET_OPCODE_PING, "", 0);
}
}
#else
......
......@@ -72,6 +72,16 @@ enum mg_event {
};
typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event);
// Websocket opcodes, from http://tools.ietf.org/html/rfc6455
enum {
WEBSOCKET_OPCODE_CONTINUATION = 0x0,
WEBSOCKET_OPCODE_TEXT = 0x1,
WEBSOCKET_OPCODE_BINARY = 0x2,
WEBSOCKET_OPCODE_CONNECTION_CLOSE = 0x8,
WEBSOCKET_OPCODE_PING = 0x9,
WEBSOCKET_OPCODE_PONG = 0xa
};
// Server management functions
struct mg_server *mg_create_server(void *server_param, mg_handler_t handler);
void mg_destroy_server(struct mg_server **);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment