wslay_event_recv − Receive messages
#include
<wslay/wslay.h>
int wslay_event_recv(wslay_event_context_ptr ctx)
wslay_event_recv() receives messages from peer. When receiving messages, it uses wslay_event_recv_callback function. Single call of this function receives multiple messages until wslay_event_recv_callback function sets error code WSLAY_ERR_WOULDBLOCK.
wslay_event_recv()
calls following callback functions for their own event (See
wslay_event_context_server_init() or
wslay_event_context_client_init() for the details of
each callbacks).
wslay_event_on_frame_recv_start_callback
Called when a new frame starts to be received.
wslay_event_on_frame_recv_start_callback
Called when a new frame starts to be received.
wslay_event_on_frame_recv_chunk_callback
Called when a chunk of frame payload is received.
wslay_event_on_frame_recv_end_callback
Called when a frame is completely received.
wslay_event_on_msg_recv_callback
Called when a message is completely received.
When close control frame is received, this function automatically queues close control frame. Also this function calls wslay_event_set_read_enabled() with second argument 0 to disable further read from peer.
When ping control frame is received, this function automatically queues pong control frame.
In case of a fatal error which leads to negative return code, this function calls wslay_event_set_read_enabled() with second argument 0 to disable further read from peer.
wslay_event_recv()
returns 0 if it succeeds, or one of the following negative
error codes:
WSLAY_ERR_CALLBACK_FAILURE
User defined callback function is failed.
WSLAY_ERR_NOMEM
Out of memory.
When negative error code is returned, application must not make any further call of wslay_event_recv() and must close WebSocket connection.
wslay_event_set_read_enabled()
Tatsuhiro Tsujikawa
2023, 2015, Tatsuhiro Tsujikawa