---
name: "coap_websockets"
section: "3"
platform: "linux"
package: "libcoap3t64"
version: "4.3.4-1.1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/coap_websockets"
---

# coap\_websockets(3)

Work with CoAP WebSockets

## NAME

coap\_websockets, coap\_ws\_is\_supported, coap\_wss\_is\_supported, coap\_ws\_set\_host\_request - Work with CoAP WebSockets

## SYNOPSIS

**#include \<coap3/coap.h\>**

**int coap\_ws\_is\_supported(void);**

**int coap\_wss\_is\_supported(void);**

**int coap\_ws\_set\_host\_request(coap\_session\_t \****session***, coap\_str\_const\_t \****ws\_host***);**

## DESCRIPTION

This man page describes the additional libcoap functions that are available for working with the optional WebSockets support.

CoAP Servers can be set up to listen for incoming WebSockets requests, and CoAP Clients can initiate WebSockets requests using the CoAP schemes coap\_ws:// and coaps+ws://.

## FUNCTIONS

**Function: coap\_ws\_is\_supported()**

The **coap\_ws\_is\_supported**() function is used to determine whether WebSockets support is available in libcoap.

**Function: coap\_wss\_is\_supported()**

The **coap\_wss\_is\_supported**() function is used to determine whether Secure WebSockets support is available in libcoap.

**Function: coap\_ws\_set\_host\_request()**

The **coap\_ws\_set\_host\_request**() function is used to set *ws\_host* as the HTTP Host: for the *session* in a WebSockets request.

## RETURN VALUES

**coap\_ws\_is\_supported**() returns 0 if there is no support, 1 if support is available.

**coap\_wss\_is\_supported**() returns 0 if there is no support, 1 if support is available.

**coap\_ws\_set\_host\_request**() returns 1 if successful, else 0 if a failure.

## SEE ALSO

[**coap\_uri**(3)](/coap_uri/3.md)

## FURTHER INFORMATION

See

"RFC7252: The Constrained Application Protocol (CoAP)"

"RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets"

for further information.

## BUGS

Please report bugs on the mailing list for libcoap: libcoap-developers@lists.sourceforge.net or raise an issue on GitHub at https://github.com/obgm/libcoap/issues

## AUTHORS

The libcoap project \<libcoap-developers@lists.sourceforge.net\>
