WSLAY_EVENT_SEND(3)
π WSLAY_EVENT_SEND(3) π
okay bestie, welcome to the wslay manual, section 3, and today's main character is wslay_event_send. yes she's a libc-adjacent queen, yes she's from the wslay fam, and yes we're gonna understand her completely. no cap. π¦
β¨ NAME β¨
wslay_event_send β send any pending messages π
πΈ SYNOPSIS πΈ
#include <wslay/wslay.h>
int wslay_event_send(wslay_event_context_ptr ctx)
π DESCRIPTION π
so like, wslay_event_send() sends all your queued messages over to the peer. that's her whole job and she eats every time. π₯
when she's actually sending a message, she uses the wslay_event_send_callback function to do it. and the way that one single call of wslay_event_send() keeps going and sends multiple messages until wslay_event_send_callback sets the error code WSLAY_ERR_WOULDBLOCK? it's giving efficient. it's giving iconic. π
if ctx was initialized for WebSocket client use, then wslay_event_send() uses wslay_event_genmask_callback to get a fresh mask key. masking era, we love to see it β¨
and when a message that got queued using wslay_event_queue_fragmented_msg() is being sent, wslay_event_send() invokes wslay_event_fragmented_msg_callback for that message. teamwork makes the dream work fr fr π«Ά
after a close control frame gets sent, this function calls wslay_event_set_write_enabled() with second argument 0 to disable any further transmission to the peer. bye bestie, connection's closing π
if there are any pending messages, wslay_event_want_write() returns 1. otherwise it returns 0. simple as that, lowkey.
and in case of a fatal error which leads to a negative return code, this function calls wslay_event_set_write_enabled() with second argument 0 to disable further transmission to the peer. like she's shutting the door, gently but firmly π
β RETURN VALUE β
wslay_event_send() returns 0 if it succeeds π β or one of these negative error codes if it does not:
WSLAY_ERR_CALLBACK_FAILUREβ the user defined callback function is failed. not her fault, it's the callback's moment of weakness πWSLAY_ERR_NOMEMβ out of memory. the RAM said no π
okay so IMPORTANT: when a negative error code is returned, the application must not make any further call of wslay_event_send() and must close the WebSocket connection. that's not a vibe suggestion, that's the rules. periodt. π
π SEE ALSO π
wslay_event_queue_fragmented_msg()wslay_event_set_write_enabled()wslay_event_want_write()
π AUTHOR π
Tatsuhiro Tsujikawa
π COPYRIGHT π
2024, 2015, Tatsuhiro Tsujikawa
and that's the whole page bestie!! this manual page is from @PACKAGE_VERSION@, dated Apr 22, 2024, and it lives under the name WSLAY_EVENT_SEND(3). go forth and send those messages, you absolute legend π§π
π¦ where this page comes from
- ubuntu noble: libwslay-doc 1.1.1-4build1 Β· MIT
- ubuntu questing: libwslay-doc 1.1.1-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms