MCO_RET mco_lews_websocket_negotiation_response(lews_connection_context_h ctx);
ctx
This function completes the WebSocket handshake by generating and sending the HTTP 101 Switching Protocols response to the client.
It computes the required
Sec-WebSocket-Acceptheader based on the value of the client’sSec-WebSocket-Key, as specified in RFC 6455, and sends the full upgrade response.The function should only be called after confirming that the incoming request is a WebSocket upgrade request (e.g., using
mco_lews_is_websocket_request()).... 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 ... } }
MCO_S_OK
MCO_E_NW_SENDERR