Lightweight C library for HTML5 websockets
Websocket status APIs


LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_send_pipe_choked (struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_is_final_fragment (struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_is_first_fragment (struct lws *wsi)
LWS_VISIBLE LWS_EXTERN unsigned char lws_get_reserved_bits (struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_partial_buffered (struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_frame_is_binary (struct lws *wsi)

Detailed Description

Websocket connection status APIs

These provide information about ws connection or message status

Function Documentation

◆ lws_frame_is_binary()

LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_frame_is_binary ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_frame_is_binary(): true if the current frame was sent in binary mode

wsithe connection we are inquiring about

This is intended to be called from the LWS_CALLBACK_RECEIVE callback if it's interested to see if the frame it's dealing with was sent in binary mode.

◆ lws_get_reserved_bits()

LWS_VISIBLE LWS_EXTERN unsigned char lws_get_reserved_bits ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_get_reserved_bits() - access reserved bits of ws frame

wsilws connection

◆ lws_is_final_fragment()

LWS_VISIBLE LWS_EXTERN int lws_is_final_fragment ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_is_final_fragment() - tests if last part of ws message

wsilws connection

◆ lws_is_first_fragment()

LWS_VISIBLE LWS_EXTERN int lws_is_first_fragment ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_is_first_fragment() - tests if first part of ws message

wsilws connection

◆ lws_partial_buffered()

LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_partial_buffered ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_partial_buffered() - find out if lws buffered the last write

wsiwebsocket connection to check

Returns 1 if you cannot use lws_write because the last write on this connection is still buffered, and can't be cleared without returning to the service loop and waiting for the connection to be writeable again.

If you will try to do >1 lws_write call inside a single WRITEABLE callback, you must check this after every write and bail if set, ask for a new writeable callback and continue writing from there.

This is never set at the start of a writeable callback, but any write may set it.

◆ lws_send_pipe_choked()

LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_send_pipe_choked ( struct lws *  wsi)

#include <include/libwebsockets/lws-ws-state.h>

lws_send_pipe_choked() - tests if socket is writable or not

wsilws connection

Allows you to check if you can write more on the socket