WSLAY_EVENT_QUEUE_FRAGMENTED_MSG_EX(3) | wslay | WSLAY_EVENT_QUEUE_FRAGMENTED_MSG_EX(3) |
wslay_event_queue_fragmented_msg_ex - Queue a fragmented message for future transmission
#include <wslay/wslay.h>
wslay_event_queue_fragmented_msg() and wslay_event_queue_fragmented_msg_ex() queue a fragmented message specified in arg. The struct wslay_event_fragmented_msg is defined as:
union wslay_event_msg_source {
int fd;
void *data; }; struct wslay_event_fragmented_msg {
uint8_t opcode;
union wslay_event_msg_source source;
wslay_event_fragmented_msg_callback read_callback; };
The opcode member is the opcode of the message. The source member is an union and normally it contains a "source" to generate message data. The read_callback is a callback function called by wslay_event_send() to read message data from source. The implementation of wslay_event_fragmented_msg_callback must store at most len bytes of data to buf and return the number of stored bytes. If all data is read (i.e., EOF), set *eof to 1. If no data can be generated at the moment, return 0. If there is an error, return -1 and set error code WSLAY_ERR_CALLBACK_FAILURE using wslay_event_set_error().
This function supports non-control messages only. For control frames, use wslay_event_queue_msg() or wslay_event_queue_close().
This function just queues a message and does not send it. wslay_event_send() function call sends these queued messages.
wslay_event_queue_fragmented_msg_ex() additionally accepts rsv parameter, which is a reserved bits to send. To set reserved bits, use macro WSLAY_RSV1_BIT, WSLAY_RSV2_BIT, and WSLAY_RSV3_BIT. See wslay_event_config_set_allowed_rsv_bits() to see the allowed reserved bits to set.
wslay_event_queue_fragmented_msg() and wslay_event_queue_fragmented_msg_ex() return 0 if it succeeds, or returns the following negative error codes:
wslay_event_queue_msg(), wslay_event_queue_msg_ex(), wslay_event_queue_close()
Tatsuhiro Tsujikawa
2021, 2015, Tatsuhiro Tsujikawa
November 7, 2021 | @PACKAGE_VERSION@ |