WebSocketSend function (websocket.h)
The WebSocketSend function adds a send operation to the protocol component operation queue.
Syntax
HRESULT WebSocketSend(
[in] WEB_SOCKET_HANDLE hWebSocket,
[in] WEB_SOCKET_BUFFER_TYPE BufferType,
[in, optional] WEB_SOCKET_BUFFER *pBuffer,
[in, optional] PVOID Context
);
Parameters
[in] hWebSocket
Type: WEB_SOCKET_HANDLE
WebSocket session handle returned by a previous call to WebSocketCreateClientHandle or WebSocketCreateServerHandle.
[in] BufferType
Type: WEB_SOCKET_BUFFER_TYPE
The type of WebSocket buffer data to send in pBuffer.
[in, optional] pBuffer
Type: WEB_SOCKET_BUFFER*
A pointer to an array of WEB_SOCKET_BUFFER structures that contains WebSocket buffer data to send. If BufferType is WEB_SOCKET_PING_PONG_BUFFER_TYPE or WEB_SOCKET_UNSOLICITED_PONG_BUFFER_TYPE, pBuffer must be NULL.
[in, optional] Context
Type: PVOID
A pointer to an application context handle that will be returned by a subsequent call to WebSocketGetAction.
Return value
Type: HRESULT
If the function succeeds, it returns S_OK.
If the function fails, it returns one of the following or a system error code defined in WinError.h.
Return code | Description |
---|---|
|
Protocol performed an invalid operation. |
Remarks
After an application sends a WEB_SOCKET_CLOSE_BUFFER_TYPE WebSocket buffer successfully, it can only send control frames.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps only] |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | websocket.h |
Library | Websocket.lib |
DLL | Websocket.dll |