ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
websocket_client Struct Reference

WebSocket client connection state. More...

#include <include/ascii-chat/network/websocket/client.h>

Data Fields

char url [512]
 
atomic_t connection_active
 
atomic_t connection_lost
 
atomic_t should_reconnect
 
uint32_t my_client_id
 
bool encryption_enabled
 
mutex_t send_mutex
 
acip_transport_t * transport
 

Detailed Description

WebSocket client connection state.

Encapsulates WebSocket-specific connection state, including:

  • Connection URL and state flags
  • Client ID and encryption state
  • Active transport (owned by websocket_client)
  • Thread-safe packet transmission mutex

This structure mirrors tcp_client_t for API compatibility. Application state (audio, threads, crypto) lives in client_context_t instead.

Thread Safety

  • Atomic fields: Safe for concurrent read/write without locks
  • Immutable after init: url is set once, then read-only
  • Mutex: Protects concurrent packet transmission

Definition at line 97 of file include/ascii-chat/network/websocket/client.h.

Field Documentation

◆ connection_active

atomic_t websocket_client::connection_active

Connection is active and ready for I/O operations

Definition at line 102 of file include/ascii-chat/network/websocket/client.h.

◆ connection_lost

atomic_t websocket_client::connection_lost

Connection was lost (triggers reconnection logic)

Definition at line 105 of file include/ascii-chat/network/websocket/client.h.

◆ encryption_enabled

bool websocket_client::encryption_enabled

Whether encryption is enabled for this connection

Definition at line 114 of file include/ascii-chat/network/websocket/client.h.

◆ my_client_id

uint32_t websocket_client::my_client_id

This client's unique ID (derived from URL hash or transport-provided)

Definition at line 111 of file include/ascii-chat/network/websocket/client.h.

◆ send_mutex

mutex_t websocket_client::send_mutex

Mutex protecting concurrent packet transmission

Definition at line 117 of file include/ascii-chat/network/websocket/client.h.

◆ should_reconnect

atomic_t websocket_client::should_reconnect

Reconnection should be attempted

Definition at line 108 of file include/ascii-chat/network/websocket/client.h.

◆ transport

acip_transport_t* websocket_client::transport

Transport instance (owned by websocket_client) - NULL until connected

Definition at line 120 of file include/ascii-chat/network/websocket/client.h.

◆ url

char websocket_client::url[512]

WebSocket server URL (e.g., "ws://localhost:27226")

Definition at line 99 of file include/ascii-chat/network/websocket/client.h.


The documentation for this struct was generated from the following file: