HCWebSocketCreate
Creates an WebSocket handle.
Syntax
HRESULT HCWebSocketCreate(
HCWebsocketHandle* websocket,
HCWebSocketMessageFunction messageFunc,
HCWebSocketBinaryMessageFunction binaryMessageFunc,
HCWebSocketCloseEventFunction closeFunc,
void* functionContext
)
Parameters
websocket _Out_
Type: HCWebsocketHandle*
The handle of the websocket.
messageFunc _In_opt_
Type: HCWebSocketMessageFunction
A pointer to the message handling callback to use, or a null pointer to remove.
binaryMessageFunc _In_opt_
Type: HCWebSocketBinaryMessageFunction
A pointer to the binary message handling callback to use, or a null pointer to remove.
closeFunc _In_opt_
Type: HCWebSocketCloseEventFunction
A pointer to the close callback to use, or a null pointer to remove.
functionContext _In_opt_
Type: void*
Client context to pass to callback function.
Return value
Type: HRESULT
Result code for this API operation. Possible values are S_OK, E_INVALIDARG, or E_FAIL.
Remarks
WebSocket usage:
Create a WebSocket handle using HCWebSocketCreate()
Call HCWebSocketSetProxyUri() and HCWebSocketSetHeader() to prepare the HCWebsocketHandle
Call HCWebSocketConnectAsync() to connect the WebSocket using the HCWebsocketHandle.
Call HCWebSocketSendMessageAsync() to send a message to the WebSocket using the HCWebsocketHandle.
Call HCWebSocketDisconnect() to disconnect the WebSocket using the HCWebsocketHandle.
Call HCWebSocketCloseHandle() when done with the HCWebsocketHandle to free the associated memory
Requirements
Header: httpClient.h
Library: libHttpClient.141.GSDK.C.lib