mco_bool mco_lews_is_websocket_request(lews_connection_context_h ctx);
ctx
This function checks whether the current request is a WebSocket upgrade request (i.e., it contains the required headers such as
Upgrade: websocketandConnection: Upgrade).It is typically used during request routing to determine if a WebSocket handshake should be performed instead of processing a regular HTTP response.
Note: a return value of
0only indicates the absence of WebSocket upgrade headers—it does not imply the request is valid HTTP.... if (IS_URL(p_ctx, "/ws")) { if (mco_lews_is_websocket_request(p_ctx)) { if (MCO_S_OK != mco_lews_websocket_negotiation_response(p_ctx)) { printf("mco_lews_websocket_negotiation_response error %d", ret); return; } // send data ... } }
1
0