WSLAY_EVENT_QUEUE_MSG_EX(3)

πŸ“¦
version 1.1.1 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– WSLAY_EVENT_QUEUE_MSG_EX(3) πŸ’–

okay bestie, welcome to the wslay corner of the manual, section 3 πŸ¦‹ β€” this is the one where we queue up a message and let it sit there, waiting for its moment. main character energy, honestly.


✨ NAME ✨

wslay_event_queue_msg_ex β€” queue a message for future transmission πŸ’Œ


🌸 SYNOPSIS 🌸

#include <wslay/wslay.h>

int wslay_event_queue_msg(wslay_event_context_ptr ctx, const struct
wslay_event_msg *arg)

int wslay_event_queue_msg_ex(wslay_event_context_ptr ctx, const struct
wslay_event_msg *arg, uint8_t rsv)

πŸŽ€ DESCRIPTION πŸŽ€

So, wslay_event_queue_msg() and wslay_event_queue_msg_ex() queue the message you specified in arg. no cap, that's the whole job. the struct wslay_event_msg is defined like this, and yes you're gonna wanna screenshot it:

struct wslay_event_msg {
    uint8_t        opcode;
    const uint8_t *msg;
    size_t         msg_length;
};
  • the opcode member is the opcode of the message πŸ‘‘
  • the msg member is the pointer to the message data πŸ“Ž
  • the msg_length member is the length of message data πŸ“

this function supports both control and non-control messages, and the given message is sent without fragmentation. if you need fragmentation, use wslay_event_queue_fragmented_msg() instead β€” that's its whole thing, let it cook. πŸ”₯

also, this function makes a copy of msg of length msg_length. so yeah, it's taking a lil photocopy, you're free to do whatever with your original after. 🫢

and listen β€” this function just queues a message, it does not send it. it's giving "waiting in the group chat drafts" energy. the wslay_event_send() function call is what actually sends these queued messages. periodt. πŸ’…

now, wslay_event_queue_msg_ex() additionally accepts the rsv parameter, which is a reserved bits to send. to set reserved bits, use the macro WSLAY_RSV1_BIT, WSLAY_RSV2_BIT, and WSLAY_RSV3_BIT. and if you wanna know which reserved bits you're even allowed to set, go check wslay_event_config_set_allowed_rsv_bits() β€” that's the vibe check right there. ⭐


🌈 RETURN VALUE 🌈

both wslay_event_queue_msg() and wslay_event_queue_msg_ex() return 0 if it succeeds 😌, or they return the following negative error codes when it's not slaying:

  • WSLAY_ERR_NO_MORE_MSG β€” could not queue given message. one of the possible reasons is that a close control frame has been queued/sent and no further queueing message is not allowed. like, the door is CLOSED, bestie. πŸ’€
  • WSLAY_ERR_INVALID_ARGUMENT β€” the given message is invalid; or RSV1 is set for control frame; or a bit is set in rsv which is not allowed (see wslay_event_config_set_allowed_rsv_bits()). 🚩
  • WSLAY_ERR_NOMEM β€” out of memory. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

  • wslay_event_queue_fragmented_msg()
  • wslay_event_queue_fragmented_msg_ex()
  • wslay_event_queue_close()

πŸ’œ AUTHOR πŸ’œ

Tatsuhiro Tsujikawa β€” legend behavior, honestly. πŸ™‡β™€οΈ


2024, 2015, Tatsuhiro Tsujikawa


and that's the whole page, bestie!! 🧚 this was WSLAY_EVENT_QUEUE_MSG_EX(3) from @PACKAGE_VERSION@, dated Apr 22, 2024 β€” go queue something iconic πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from