WebSocketSend function
The WebSocketSend function adds a send operation to the protocol component operation queue.
Syntax
HRESULT WINAPI WebSocketSend( _In_ WEB_SOCKET_HANDLE hWebSocket, _In_ WEB_SOCKET_BUFFER_TYPE BufferType, _In_opt_ WEB_SOCKET_BUFFER *pBuffer, _In_opt_ PVOID Context );
Parameters
- hWebSocket [in]
-
Type: WEB_SOCKET_HANDLE
WebSocket session handle returned by a previous call to WebSocketCreateClientHandle or WebSocketCreateServerHandle.
- BufferType [in]
-
Type: WEB_SOCKET_BUFFER_TYPE
The type of WebSocket buffer data to send in pBuffer.
- pBuffer [in, optional]
-
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.
Note Once WEB_SOCKET_INDICATE_SEND_COMPLETE is returned by WebSocketGetAction for this action, the memory pointer to by pBuffer can be reclaimed. - Context [in, optional]
-
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
|
Minimum supported client | Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also