Skip to content

Struct SYN_WebsocketSession

ClassList > SYN_WebsocketSession

WebSocket session context.

  • #include <syn_websocket.h>

Public Attributes

Type Name
uint32_t bytes_read
void * ctx
uint8_t mask_key
bool masked
void(* on_message
User callback invoked when a complete frame is received.
uint8_t opcode
uint32_t payload_len
uint8_t rx_buf
uint8_t rx_state
SYN_Socket sock
SYN_WebsocketState state

Public Attributes Documentation

variable bytes_read

uint32_t SYN_WebsocketSession::bytes_read;

Accumulated payload bytes read so far


variable ctx

void* SYN_WebsocketSession::ctx;

User context pointer for message callback


variable mask_key

uint8_t SYN_WebsocketSession::mask_key[4];

Client-to-server frame masking key


variable masked

bool SYN_WebsocketSession::masked;

True if the incoming frame is masked


variable on_message

User callback invoked when a complete frame is received.

void(* SYN_WebsocketSession::on_message) (const uint8_t *payload, size_t len, uint8_t opcode, void *ctx);

Parameters:

  • payload Received frame data.
  • len Frame length in bytes.
  • opcode Frame type opcode.
  • ctx User context pointer.

variable opcode

uint8_t SYN_WebsocketSession::opcode;

WebSocket opcode (e.g. text, binary, close, ping)


variable payload_len

uint32_t SYN_WebsocketSession::payload_len;

Size of the current incoming frame payload


variable rx_buf

uint8_t SYN_WebsocketSession::rx_buf[128];

Payload receive packet storage


variable rx_state

uint8_t SYN_WebsocketSession::rx_state;

Frame parsing state: 0=header, 1=length, 2=mask, 3=payload


variable sock

SYN_Socket SYN_WebsocketSession::sock;

Network socket handle


variable state

SYN_WebsocketState SYN_WebsocketSession::state;

WebSocket connection state



The documentation for this class was generated from the following file src/syntropic/net/syn_websocket.h