Sockudo provides a flexible configuration system that allows you to configure the server through multiple methods, each with different priority levels.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sockudo/sockudo/llms.txt
Use this file to discover all available pages before exploring further.
Configuration Hierarchy
Configuration values are resolved in the following order (highest priority wins):- Environment Variables (highest priority)
- Command-line Arguments
- Config File (
config/config.json) - Default Values (hardcoded, lowest priority)
Configuration File
The primary configuration file isconfig/config.json, which contains all server settings in JSON format.
Basic Structure
Core Settings
Enable debug logging for detailed troubleshooting. Can also be set via
DEBUG or DEBUG_MODE environment variables.Server host binding address. Use
0.0.0.0 to listen on all interfaces, or 127.0.0.1 for localhost only.WebSocket server port. Override via
PORT environment variable.Server mode:
production or development. Affects logging verbosity and error handling. Set via ENVIRONMENT environment variable.URL path prefix for all endpoints. Useful when running behind a reverse proxy with path-based routing.
Graceful shutdown timeout in seconds. Allows active connections to complete before forcing shutdown.
User authentication token TTL in seconds (default: 1 hour).
Connection activity timeout in seconds before marking as inactive.
Maximum WebSocket message payload size in kilobytes.
Environment Variables
All configuration options can be set via environment variables. See the Environment Variables page for a complete reference.Common Environment Variables
Command-line Arguments
You can override configuration values using command-line flags:Configuration Sections
Sockudo’s configuration is organized into functional sections:- Adapters - Connection management and horizontal scaling (Local, Redis, Redis Cluster, NATS)
- Backends - App managers, cache, and queue drivers
- SSL/TLS - Certificate configuration and HTTPS setup
- WebSocket - Buffer limits, compression, and connection settings
- Environment Variables - Complete reference of all environment variables
Best Practices
Development
- Use
config.jsonfor local development settings - Set
debug: trueorDEBUG=truefor detailed logging - Use
localadapter for single-instance testing - Use
memorydrivers for app manager, cache, and queue
Production
- Use environment variables for sensitive values (passwords, secrets)
- Enable SSL/TLS with valid certificates
- Configure Redis/Redis Cluster/NATS adapter for horizontal scaling
- Use persistent storage for app manager (MySQL, PostgreSQL, DynamoDB)
- Set appropriate connection and rate limits
- Configure structured logging (
LOG_OUTPUT_FORMAT=json) - Enable metrics for monitoring (
METRICS_ENABLED=true)
Docker/Kubernetes
- Mount
config.jsonas a ConfigMap - Store secrets in environment variables or Secret objects
- Use readiness/liveness probes with
/up/{app_id}endpoint - Configure resource limits based on expected load
- Use Redis Cluster for high availability
Validation
Sockudo validates configuration at startup and will fail with descriptive error messages if:- Required fields are missing
- Values are out of valid range
- Backend drivers are configured but the feature is not compiled in
- SSL certificates are enabled but files don’t exist
- Redis/database connections cannot be established
Next Steps
Adapter Configuration
Configure horizontal scaling with Redis, Redis Cluster, or NATS
Backend Drivers
Set up app managers, cache, and queue backends
SSL/TLS Setup
Enable HTTPS with certificates
WebSocket Settings
Configure buffers and connection limits