6#ifndef __CWIST_WEBSOCKET_H__
7#define __CWIST_WEBSOCKET_H__
89 uint16_t chunk_payload_size);
HTTP Protocol Definitions and Helpers.
struct cwist_websocket cwist_websocket
struct cwist_ws_frame cwist_ws_frame
cwist_websocket * cwist_websocket_upgrade(cwist_http_request *req, int client_fd)
Upgrade a standard HTTP request to a WebSocket connection.
int cwist_websocket_send_sequenced(cwist_websocket *ws, const uint8_t *data, size_t len, uint16_t chunk_payload_size)
Send a large payload as sequenced binary frames.
cwist_ws_frame * cwist_websocket_receive(cwist_websocket *ws)
Receive a frame, blocking until data arrives or the socket closes.
@ CWIST_WS_FRAME_CONTINUATION
void cwist_websocket_close(cwist_websocket *ws)
Close the WebSocket connection.
int cwist_websocket_send(cwist_websocket *ws, cwist_ws_opcode_t opcode, const uint8_t *data, size_t len)
Send a frame with the specified opcode and payload.
uint8_t * cwist_websocket_receive_sequenced(cwist_websocket *ws, size_t *out_len)
Receive and reassemble a sequenced binary message.
bool cwist_websocket_upgrade_response(cwist_http_request *req, cwist_http_response *res)
Validate the upgrade request and fill a 101 Switching Protocols response.
void cwist_websocket_frame_destroy(cwist_ws_frame *frame)
Destroy a frame.
void cwist_websocket_destroy(cwist_websocket *ws)
Destroy the WebSocket context.
HTTP Response Object. Supports standard string body or Zero-Copy pointer body.
cwist_ws_opcode_t frag_opcode