mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Added MG_WS_HANDSHAKE
This commit is contained in:
parent
d8b4db37a0
commit
05d7b7c8bc
@ -2631,8 +2631,10 @@ static void send_websocket_handshake_if_requested(struct mg_connection *conn) {
|
|||||||
*key = mg_get_header(conn, "Sec-WebSocket-Key");
|
*key = mg_get_header(conn, "Sec-WebSocket-Key");
|
||||||
if (ver != NULL && key != NULL) {
|
if (ver != NULL && key != NULL) {
|
||||||
conn->is_websocket = 1;
|
conn->is_websocket = 1;
|
||||||
|
if (call_user(MG_CONN_2_CONN(conn), MG_WS_HANDSHAKE) == MG_FALSE) {
|
||||||
send_websocket_handshake(conn, key);
|
send_websocket_handshake(conn, key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ping_idle_websocket_connection(struct connection *conn, time_t t) {
|
static void ping_idle_websocket_connection(struct connection *conn, time_t t) {
|
||||||
|
@ -67,7 +67,7 @@ enum mg_event {
|
|||||||
MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req
|
MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req
|
||||||
MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection
|
MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection
|
||||||
MG_CLOSE, // Connection is closed, callback return value is ignored
|
MG_CLOSE, // Connection is closed, callback return value is ignored
|
||||||
MG_LUA, // Called before LSP page invoked
|
MG_WS_HANDSHAKE, // New websocket connection, handshake request
|
||||||
MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err
|
MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err
|
||||||
};
|
};
|
||||||
typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event);
|
typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event);
|
||||||
|
Loading…
Reference in New Issue
Block a user