Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kStatus kWebSocket_Receive ( kWebSocket  webSocket,
k64u  timeout 
)

Blocks until a new message is available for reading.

The Receive method should be used to wait for a new message. Once a new message has been detected, kStream methods can be used to read out the data. When the message has been completely read out, additional kStream read calls will return kERROR_NOT_FOUND. At this point, kWebSocket_Receive can be used to wait for another message.

Multi-frame WebSocket messages will be treated as a single message. If kWebSocket_Receive is called before the previous message has been completely read out, any remaining data in the previous message will be discarded before waiting for a new message.

If this function returns successfully, the kWebSocket_ReceiveType method can optionally be used to determine the type of incoming data.

Parameters
webSocketWebSocket object.
timeoutTimeout, in microseconds.
Returns
Operation status.