mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-24 11:54:49 +00:00
Added enum for websocket opcodes
This commit is contained in:
1 parent
05d7b7c8bc
commit
464b895116
2 files changed
+11
-1
No files matched your search
+1
-1
@@ -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
|
||||
|
||||
+10
@@ -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 **);
|
||||
|
||||
Reference in new issue
Block a user