DOKK / manpages / debian 10 / libwslay-doc / wslay_event_send.3.en
WSLAY_EVENT_SEND(3) wslay WSLAY_EVENT_SEND(3)

wslay_event_send - Send any pending messages

#include <wslay/wslay.h>


wslay_event_send() sends queued messages to peer. When sending a message, it uses wslay_event_send_callback function. Single call of wslay_event_send() sends multiple messages until wslay_event_send_callback sets error code WSLAY_ERR_WOULDBLOCK.

If ctx is initialized for WebSocket client use, wslay_event_send() uses wslay_event_genmask_callback to get new mask key.

When a message queued using wslay_event_queue_fragmented_msg() is sent, wslay_event_send() invokes wslay_event_fragmented_msg_callback for that message.

After close control frame is sent, this function calls wslay_event_set_write_enabled() with second argument 0 to disable further transmission to peer.

If there are any pending messages, wslay_event_want_write() returns 1, otherwise returns 0.

In case of a fatal error which leads to negative return code, this function calls wslay_event_set_write_enabled() with second argument 0 to disable further transmission to peer.

wslay_event_send() 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_send() and must close WebSocket connection.

wslay_event_queue_fragmented_msg(), wslay_event_set_write_enabled(), wslay_event_want_write()

Tatsuhiro Tsujikawa

2018, 2015, Tatsuhiro Tsujikawa

September 30, 2018 @PACKAGE_VERSION@