---
name: "wslay_event_queue_close"
section: "3"
platform: "linux"
package: "libwslay"
version: "1.1.1-7"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/wslay_event_queue_close"
---

# wslay\_event\_queue\_close(3)

Queue a close control frame

## NAME

wslay\_event\_queue\_close - Queue a close control frame

## SYNOPSIS

\#include \<wslay/wslay.h\>

- **int wslay\_event\_queue\_close(wslay\_event\_context\_ptr *ctx*, uint16\_t *status\_code*, const uint8\_t *\*reason*, size\_t *reason\_length*)**

  ## DESCRIPTION

*wslay\_event\_queue\_close()* queues close control frame. This function is provided just for convenience. **wslay\_event\_queue\_msg()** can queue a close control frame as well. *status\_code* is the status code of close control frame. *reason* is the close reason encoded in UTF-8. *reason\_length* is the length of *reason* in bytes. *reason\_length* must be less than 123 bytes.

If *status\_code* is 0, *reason* and *reason\_length* is not used and close control frame with zero-length payload will be queued.

This function just queues a message and does not send it. **wslay\_event\_send()** function call sends these queued messages.

## RETURN VALUE

*wslay\_event\_queue\_close()* returns 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.

- **WSLAY\_ERR\_NOMEM**

  Out of memory.

## SEE ALSO

**wslay\_event\_queue\_msg()**, **wslay\_event\_queue\_fragmented\_msg()**

## AUTHOR

Tatsuhiro Tsujikawa

## COPYRIGHT

2012, 2015, Tatsuhiro Tsujikawa
