---
name: "wslay_event_queue_msg_ex"
section: "3"
platform: "linux"
package: "libwslay-doc"
version: "1.1.1-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wslay_event_queue_msg_ex"
---

# wslay\_event\_queue\_msg\_ex(3)

Queue a message for future transmission

## 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

*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()* 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()* 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()* to see the allowed reserved bits to set.

## RETURN VALUE

*wslay\_event\_queue\_msg()* and *wslay\_event\_queue\_msg\_ex()* return 0 if it succeeds, or returns the following negative error codes:

- **WSLAY\_ERR\_NO\_MORE\_MSG**

  Could not queue given message. The one of possible reason is that close control frame has been queued/sent and no further queueing message is not allowed.

- **WSLAY\_ERR\_INVALID\_ARGUMENT**

  The given message is invalid; or RSV1 is set for control frame; or 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

## COPYRIGHT

2023, 2015, Tatsuhiro Tsujikawa
