WebSocketReceive function (websocket.h)

The WebSocketReceive function adds a receive operation to the protocol component operation queue.

Syntax

HRESULT WebSocketReceive(
  [in]           WEB_SOCKET_HANDLE hWebSocket,
  [in, optional] WEB_SOCKET_BUFFER *pBuffer,
  [in, optional] PVOID             pvContext
);

Parameters

[in] hWebSocket

Type: WEB_SOCKET_HANDLE

WebSocket session handle returned by a previous call to WebSocketCreateClientHandle or WebSocketCreateServerHandle.

[in, optional] pBuffer

Type: WEB_SOCKET_BUFFER*

A pointer to an array of WEB_SOCKET_BUFFER structures that WebSocket data will be written to when it is returned by WebSocketGetAction. If NULL, WebSocketGetAction will return an internal buffer that enables zero-copy scenarios.

Note  Once WEB_SOCKET_INDICATE_RECEIVE_COMPLETE is returned by WebSocketGetAction for this action, the memory pointer to by pBuffer can be reclaimed.
 

[in, optional] pvContext

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
E_INVALID_PROTOCOL_OPERATION
Protocol performed an invalid operation.

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

See also

WEB_SOCKET_ACTION

WebSocketAbortHandle

WebSocketCompleteAction

WebSocketGetAction

WebSocketSend