funal/soketi-rs

By funal

β€’Updated 2 months ago

Rust-powered WebSocket server with Pusher protocol. Public, private & presence channels. Clustering

Image
Networking
Languages & frameworks
Web servers
0

3.3K

funal/soketi-rs repository overview

⁠Soketi.rs - High-Performance WebSocket Server

GitHub Rust License

A high-performance, Pusher-compatible WebSocket server written in Rust. Soketi.rs provides real-time messaging capabilities with support for public, private, and presence channels.

⁠Quick Start

# Pull and run the latest image
docker pull funal/soketi-rs:latest

# Run with default configuration
docker run -d \
  --name soketi \
  -p 6001:6001 \
  -p 9601:9601 \
  funal/soketi-rs:latest

# Run with custom configuration
docker run -d \
  --name soketi \
  -p 6001:6001 \
  -p 9601:9601 \
  -v $(pwd)/config.json:/app/config.json \
  funal/soketi-rs:latest

⁠Features

  • πŸš€ High Performance - Built with Rust for maximum speed and efficiency
  • πŸ“‘ Pusher Compatible - 100% compatible with Pusher client libraries
  • πŸ” Authentication - Built-in support for private and presence channels
  • πŸ‘₯ Presence Channels - Real-time user tracking and member lists
  • πŸ’¬ Client Events - Direct client-to-client messaging
  • πŸ“Š Metrics - Prometheus metrics for monitoring
  • πŸ”„ Horizontal Scaling - Redis adapter for multi-server deployments
  • πŸ—„οΈ Multiple Backends - Support for MySQL, PostgreSQL, DynamoDB
  • 🎯 Rate Limiting - Configurable rate limits per app
  • πŸͺ Webhooks - Event notifications via HTTP callbacks

⁠Environment Variables

# Server configuration
SOKETI_HOST=0.0.0.0
SOKETI_PORT=6001
SOKETI_DEBUG=false

# App configuration
APP_ID=your-app-id
APP_KEY=your-app-key
APP_SECRET=your-app-secret

# Redis (for clustering)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0

# Metrics
METRICS_ENABLED=true
METRICS_PORT=9601

⁠Docker Compose Example

version: '3.8'

services:
  soketi:
    image: funal/soketi-rs:latest
    ports:
      - "6001:6001"
      - "9601:9601"
    environment:
      - SOKETI_HOST=0.0.0.0
      - SOKETI_PORT=6001
      - APP_ID=app-id
      - APP_KEY=app-key
      - APP_SECRET=app-secret
    volumes:
      - ./config.json:/app/config.json
    restart: unless-stopped

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"
    restart: unless-stopped

⁠Basic Configuration

Create a config.json file:

{
  "host": "0.0.0.0",
  "port": 6001,
  "debug": false,
  "app_manager": {
    "driver": "Array",
    "array": {
      "apps": [
        {
          "id": "app-id",
          "key": "app-key",
          "secret": "app-secret",
          "enabled": true,
          "enable_client_messages": true,
          "max_connections": 10000
        }
      ]
    }
  }
}

⁠Client Usage

// Initialize Pusher client
const pusher = new Pusher('app-key', {
  wsHost: 'localhost',
  wsPort: 6001,
  forceTLS: false,
  encrypted: false
});

// Subscribe to a channel
const channel = pusher.subscribe('chat-room');

// Listen for messages
channel.bind('new-message', (data) => {
  console.log('New message:', data.message);
});

⁠Production Deployment

⁠With Redis Clustering
version: '3.8'

services:
  soketi:
    image: funal/soketi-rs:latest
    ports:
      - "6001:6001"
      - "9601:9601"
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    volumes:
      - ./config.production.json:/app/config.json
    depends_on:
      - redis
    deploy:
      replicas: 3
    restart: unless-stopped

  redis:
    image: redis:alpine
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - soketi
    restart: unless-stopped
⁠Scaling
# Scale soketi instances
docker-compose up -d --scale soketi=3

# View service status
docker-compose ps

⁠Health Check

# Check if server is running
curl http://localhost:6001/

# Check metrics
curl http://localhost:9601/metrics

⁠Ports

  • 6001 - WebSocket server (default)
  • 9601 - Prometheus metrics endpoint

⁠Supported Architectures

  • linux/amd64
  • linux/arm64

⁠Performance

  • Connections: 100,000+ concurrent connections per instance
  • Messages: 1M+ messages per second
  • Latency: <1ms average message latency
  • Memory: ~50MB base + ~1KB per connection

⁠Documentation

⁠Client Libraries

Compatible with all Pusher client libraries:

⁠Support

⁠License

This project is licensed under the GPL-3.0 License - see the LICENSE⁠ file for details.


Made with ❀️ by Ferdi ÜNAL⁠

Tag summary

Content type

Image

Digest

sha256:ffc6ad090…

Size

12.7 MB

Last updated

2 months ago

docker pull funal/soketi-rs