ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/network/websocket/server.h
Go to the documentation of this file.
1#pragma once
2
51
53#include <stdint.h>
54#include <stdbool.h>
55#include <libplatform/atomic.h>
56#include "../../common.h"
57#include "../../thread_pool.h"
58#include <libwebsockets.h>
59
60// Forward declarations
62typedef struct acip_transport acip_transport_t;
64
76typedef void *(*websocket_client_handler_fn)(void *arg);
77
95
107
120
131
141
148
Application limits and constraints.
⚙️ Common definitions, error codes, macros, and types shared throughout the application
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
#define IP_ADDRESS_BUFFER_SIZE
struct acip_transport acip_transport_t
Forward declaration of ACIP transport.
Definition host.h:506
asciichat_error_t websocket_server_init(websocket_server_t *server, const websocket_server_config_t *config)
Initialize WebSocket server.
asciichat_error_t websocket_server_run(websocket_server_t *server)
Run WebSocket server event loop.
void websocket_server_destroy(websocket_server_t *server)
Destroy WebSocket server and free resources.
struct thread_pool thread_pool_t
One queued function call waiting for a thread-pool worker.
void *(* websocket_client_handler_fn)(void *arg)
Connection-specific values handed to a WebSocket client worker.
void websocket_server_cancel_service(websocket_server_t *server)
Wake the WebSocket server event loop immediately.
struct websocket_server websocket_server_t
Thread pool structure.
Listener settings and callbacks used to create a WebSocket server.
acip_transport_t * transport
ACIP transport for this client.
char client_ip[64]
Client IP address (for logging/rate limiting).
bool auth_required
True if client authentication is required.
void * user_data
User-provided data from server config.
bool is_secure
True if connection is using TLS (wss://).
Listener settings and callbacks used to create a WebSocket server.
websocket_client_handler_fn client_handler
Handler for new connections.
const char * bind_address
Numeric local address to listen on (never a wildcard by default).
const char * tls_cert_path
TLS certificate file path (optional, for wss://).
const char * tls_key_path
TLS private key file path (optional, for wss://).
Runtime state for the WebSocket listener and its client-handler pool.
websocket_client_handler_fn handler
Client handler function.
struct thread_pool * handler_pool
Thread pool for queueing handler work.
struct lws_context * context
libwebsockets context
bool tls_enabled
True when this listener is configured with TLS credentials.
🧵 Generic thread pool abstraction for managing worker threads