wslay_event_queue_msg
Queue a message for future transmission
- Provided by: libwslay-doc (Version: 1.1.1-5)
- Source: wslay
- Report a bug
Queue a message for future transmission
#include <wslay/wslay.h>
wslay_event_queue_msg() and wslay_event_queue_msg_ex() queue message specified in arg. The struct wslay_event_msg is defined as:
struct wslay_event_msg {
uint8_t opcode;
const uint8_t *msg;
size_t msg_length;
};
The opcode member is 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 fragmentation is needed, use wslay_event_queue_fragmented_msg() <#c.wslay_event_queue_fragmented_msg> function instead.
This function makes a copy of msg of length msg_length.
This function just queues a message and does not send it. wslay_event_send() <#c.wslay_event_send> function call sends these queued messages.
wslay_event_queue_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() <#c.wslay_event_config_set_allowed_rsv_bits> to see the allowed reserved bits to set.
wslay_event_queue_msg() and wslay_event_queue_msg_ex() return 0 if it succeeds, or returns the following negative error codes:
wslay_event_queue_fragmented_msg() <#c.wslay_event_queue_fragmented_msg>, wslay_event_queue_fragmented_msg_ex() <#c.wslay_event_queue_fragmented_msg_ex>, wslay_event_queue_close() <#c.wslay_event_queue_close>
Tatsuhiro Tsujikawa
2012, 2015, Tatsuhiro Tsujikawa