mco_lews_is_websocket_close_frame

Prototype

    int mco_lews_is_websocket_close_frame(const char *buf, mco_size_t buf_size);

Arguments

buf
Pointer to the raw incoming data buffer.
buf_size
Size (in bytes) of the buffer pointed to by buf.

Description

This function is used to detect client-initiated WebSocket shutdown requests.

The function checks whether the provided buffer contains a valid WebSocket close control frame as defined in RFC 6455.

It validates the following aspects of the frame:

Return Value

1
The buffer contains a fully valid WebSocket close frame.
0
The buffer does not contain a valid close frame (e.g., wrong opcode, invalid structure, unsupported close code, or insufficient data).

Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a