HCWebSocketSendMessageFunction
Sends a text message on a WebSocket when you replace the libHttpClient WebSocket implementation. libHttpClient calls this callback when the title calls HCWebSocketSendMessageAsync.Syntax
Parameters
websocket   _In_Type: HCWebsocketHandle The handle of the connected WebSocket. message   _In_z_
Type: const char* The UTF-8 encoded text message to send. asyncBlock   _Inout_
Type: XAsyncBlock* The async block that the title passed to HCWebSocketSendMessageAsync. 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 HCWebSocketSendMessageAsync. ReturnS_OK if the send operation started.
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 calls this callback only while the WebSocket is connected. Otherwise, HCWebSocketSendMessageAsync returns E_UNEXPECTED without calling the callback.
The title gets the result by calling HCGetWebSocketSendMessageResult, which calls XAsyncGetResult with HCWebSocketSendMessageAsync as the identity and a WebSocketCompletionResult buffer. Your implementation must therefore begin the operation on asyncBlock by calling XAsyncBegin with HCWebSocketSendMessageAsync as the identity, complete it with XAsyncComplete(asyncBlock, hr, sizeof(WebSocketCompletionResult)), and fill the result in the XAsyncOp::GetResult operation.
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
