wslay_event_recv3
Receive messages
Usage
#include <wslay/wslay.h>
- int wslay_event_recv(wslay_event_context_ptr ctx)
Overview
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).
|
Called when a new frame starts to be received. |
|---|---|
|
Called when a new frame starts to be received. |
|
Called when a chunk of frame payload is received. |
|
Called when a frame is completely received. |
|
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.
Return value
wslay_event_recv() returns 0 if it succeeds, or one of the following negative error codes:
|
User defined callback function is failed. |
|---|---|
|
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.
Releases
5 releases since Debian 10 (Buster); the text changed 4 times.