On Close
Called when a WebSocket Connection has closed.
Note that it doesn't guarantee that the closing handshake is completed, but only notify that the connection will not send or receive WebSocket Message anymore.
Prototype
void HTTPc_WebSockOnClose (HTTPc_CONN_OBJ *p_conn, HTTPc_WEBSOCK_CLOSE_CODE close_code, HTTPc_WEBSOCK_CLOSE_REASON *p_reason);
Arguments
p_conn
Pointer to the current HTTPc Connection Object.
close_code
Code defined by the RFC to explain the reason of the connection closing.
p_reason
Pointer that contains the data following the close code and the length.
Return Values
None.
Required Configuration
- The HTTPc_CFG_WEBSOCKET_EN configuration macro MUST be enabled.
Notes / Warnings
- This hook is set in a HTTPc_WEBSOCK_OBJ using HTTPc_WebSockSetParam() with the parameter HTTPc_PARAM_TYPE_WEBSOCK_ON_CLOSE.
- Must be set to the HTTPc_WEBSOCK_OBJ before upgrading the connection with HTTPc_WebSockUpgrade().