HCWebSocketDisconnectFunction
Closes a WebSocket when you replace the libHttpClient WebSocket implementation. libHttpClient calls this callback when the title calls HCWebSocketDisconnect or HCWebSocketDisconnectWithStatus.Syntax
Parameters
websocket   _In_Type: HCWebsocketHandle The handle of the WebSocket to close. closeStatus   _In_
Type: HCWebSocketCloseStatus The close status to send to the peer. HCWebSocketDisconnect passes
HCWebSocketCloseStatus::Normal.
context   _In_opt_Type: void* The
context value that you passed to HCSetWebSocketFunctions.
Return value
Type: HRESULT libHttpClient returns this value to the caller of HCWebSocketDisconnect or HCWebSocketDisconnectWithStatus.Remarks
Register this callback, together with the other three WebSocket callbacks, by calling HCSetWebSocketFunctions before HCInitialize. HCSetWebSocketFunctions requires all four callbacks; it returnsE_INVALIDARG if any of them is nullptr.
libHttpClient invokes this callback synchronously; it has no async block. Start the close handshake and return. The close handshake itself doesn’t need to finish before the callback returns.
When the connected WebSocket closes, report the closure by calling the close event function returned by HCWebSocketGetEventFunctions, passing the websocket handle and the context returned with that function. libHttpClient uses this notification to release the state that it keeps for the connection.
libHttpClient calls this callback only while the WebSocket is connected. If a disconnect is already in progress, HCWebSocketDisconnect returns S_OK without calling the callback again.
This callback type isn’t declared when HC_NOWEBSOCKETS is defined.
Requirements
Header: httpProvider.h Library: libHttpClient.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consolesSee also
httpProviderHCSetWebSocketFunctions
HCGetWebSocketFunctions
