Provided by: libwslay-doc_1.1.1-4build1_all
NAME
wslay_event_send - Send any pending messages
SYNOPSIS
#include <wslay/wslay.h> int wslay_event_send(wslay_event_context_ptr ctx)
DESCRIPTION
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.
RETURN VALUE
wslay_event_send() 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_send() and must close WebSocket connection.
SEE ALSO
wslay_event_queue_fragmented_msg(), wslay_event_set_write_enabled(), wslay_event_want_write()
AUTHOR
Tatsuhiro Tsujikawa
COPYRIGHT
2024, 2015, Tatsuhiro Tsujikawa @PACKAGE_VERSION@ Apr 22, 2024 WSLAY_EVENT_SEND(3)