Adapters handle connection management, channel subscriptions, and inter-node communication in Sockudo. The adapter you choose determines how Sockudo scales horizontally.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.
Available Adapters
Local
Single-instance, in-memory adapter. No external dependencies.
Redis
Pub/Sub-based horizontal scaling using Redis.
Redis Cluster
Distributed Redis Cluster support for high availability.
NATS
Lightweight messaging with NATS for horizontal scaling.
Adapter Selection
Set the adapter driver in your configuration:Local Adapter
The local adapter stores all connection and subscription data in memory. It’s suitable for:- Single-instance deployments
- Development and testing
- Low-traffic applications
Configuration
Set to
"local" for in-memory adapter.Enable counting of active sockets per channel. Disable for performance if you don’t use the
get_sockets_count API.The local adapter does not support horizontal scaling. All connections must connect to the same instance.
Redis Adapter
The Redis adapter uses Redis Pub/Sub for inter-node communication, enabling horizontal scaling across multiple Sockudo instances.Configuration
Environment Variables
Redis URL Override
You can use a single URL to configure Redis:Redis Configuration Options
Redis server hostname or IP address.
Redis server port.
Redis username for ACL authentication (Redis 6+).
Redis password for authentication.
Redis database number (0-15).
Prefix for all Redis keys to avoid collisions with other applications.
Redis Sentinel
Redis Sentinel provides high availability for Redis by automatically handling master failover.Configuration
Array of sentinel nodes with
host and port fields.Password for authenticating with sentinel nodes (if required).
The master name monitored by sentinels.
Password for the Redis master instance.
Username for Redis ACL authentication.
When sentinels are configured, the connection URL is automatically built in the format:
redis+sentinel://[sentinelpass@]host1:port1,host2:port2/master-name/db[?password=masterpass]Redis Cluster Adapter
Redis Cluster provides automatic sharding and high availability across multiple Redis nodes.Configuration
Environment Variables
Redis Cluster Options
Array of Redis cluster node addresses in
host:port format. Accepts redis://host:port or rediss://host:port URLs.Key prefix for adapter data in Redis Cluster.
Timeout for Redis Cluster requests in milliseconds.
Use connection pooling for better performance.
Cluster Health Monitoring
Enable cluster health checks and automatic node failure detection.
Interval between heartbeat checks in milliseconds.
Time to wait before marking a node as failed.
Interval for cleaning up failed node metadata.
NATS Adapter
NATS is a lightweight, high-performance messaging system ideal for microservices architectures.Configuration
Comma-separated list of NATS server URLs (e.g.,
nats://host:port).NATS username for authentication.
NATS password for authentication.
NATS authentication token (alternative to username/password).
Connection timeout in milliseconds.
Request timeout in milliseconds.
Unix Socket Configuration
For deployments behind a reverse proxy, you can use Unix domain sockets instead of TCP/IP:Environment Variables
Enable Unix socket server (disables HTTP/HTTPS when enabled).
Path to Unix socket file.
Socket file permissions in octal notation (e.g., “660”, “755”).
Nginx Example
Unix sockets are only available on Unix-like systems (Linux, macOS). On Windows, this configuration is ignored.
Feature Compilation
Adapters must be compiled into the binary. Use Cargo features during build:Performance Considerations
Socket Counting
Theenable_socket_counting option tracks the number of active connections per channel. This is used by the get_sockets_count API but has a small performance overhead.
Disable if you don’t need this metric:
Redis Connection Pooling
Redis adapters use connection pooling automatically. Adjust pool size via:Next Steps
Backend Configuration
Configure app managers, cache, and queue
Horizontal Scaling Guide
Deploy multi-instance Sockudo clusters