docker.recipes

Soketi

beginner

Open-source WebSocket server (Pusher replacement).

Overview

Soketi is an open-source WebSocket server that serves as a complete replacement for Pusher, offering 100% protocol compatibility while maintaining full control over your real-time messaging infrastructure. Built with Node.js and designed for high performance, Soketi supports all Pusher features including presence channels, client events, and webhooks, making it an ideal solution for developers seeking to eliminate third-party dependencies and reduce costs associated with managed WebSocket services. This Docker deployment configures Soketi with essential environment variables for app authentication and exposes both the WebSocket server and Prometheus metrics endpoints. The containerized setup simplifies the deployment of a production-ready WebSocket server that can handle thousands of concurrent connections while providing detailed metrics for monitoring and observability. Soketi's architecture allows it to scale horizontally and integrates naturally with existing applications that already use Pusher's client libraries, requiring only a host URL change to migrate from the managed service. The server supports multiple applications through configuration, making it suitable for multi-tenant environments or organizations running multiple real-time applications. This configuration is perfect for development teams transitioning away from Pusher's paid tiers, startups building real-time features without external dependencies, and enterprises requiring on-premises WebSocket infrastructure with full data control. DevOps engineers will appreciate the straightforward deployment model and built-in metrics endpoint, while developers can continue using familiar Pusher client libraries and authentication patterns without code changes.

Key Features

  • Complete Pusher protocol compatibility supporting pusher-js and all official client libraries
  • Presence channels with user authentication and member tracking capabilities
  • Client-to-client event broadcasting within subscribed channels
  • Webhook integration for real-time event notifications to backend services
  • Prometheus metrics endpoint on port 9601 for monitoring connection counts and message throughput
  • Multi-application support through JSON configuration or environment variables
  • SSL/TLS termination support for secure WebSocket connections
  • Rate limiting and connection throttling to prevent abuse and resource exhaustion

Common Use Cases

  • 1Migrating from Pusher to reduce monthly WebSocket service costs while maintaining functionality
  • 2Building real-time chat applications with presence indicators and typing notifications
  • 3Creating live dashboards and analytics displays with instant data updates
  • 4Developing collaborative editing tools requiring real-time document synchronization
  • 5Implementing live gaming features like multiplayer lobbies and match updates
  • 6Building notification systems for web applications without polling mechanisms
  • 7Creating real-time trading platforms or financial data streaming applications

Prerequisites

  • Docker and Docker Compose installed with at least 512MB available memory
  • Ports 6001 and 9601 available and not blocked by firewall rules
  • Environment variables APP_ID, APP_KEY, and APP_SECRET defined for client authentication
  • Basic understanding of WebSocket protocols and Pusher client library integration
  • SSL certificate if planning to serve WebSocket connections over WSS protocol
  • Monitoring system capable of scraping Prometheus metrics from port 9601

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 soketi:
3 image: quay.io/soketi/soketi:latest
4 container_name: soketi
5 restart: unless-stopped
6 environment:
7 SOKETI_DEFAULT_APP_ID: ${APP_ID}
8 SOKETI_DEFAULT_APP_KEY: ${APP_KEY}
9 SOKETI_DEFAULT_APP_SECRET: ${APP_SECRET}
10 ports:
11 - "6001:6001"
12 - "9601:9601"

.env Template

.env
1APP_ID=app-id
2APP_KEY=app-key
3APP_SECRET=app-secret

Usage Notes

  1. 1Docs: https://docs.soketi.app/
  2. 2WebSocket server on port 6001, Prometheus metrics on 9601
  3. 3100% Pusher protocol compatible - use pusher-js client library
  4. 4Configure app credentials via env vars or JSON config
  5. 5Drop-in replacement for Pusher - change host only
  6. 6Supports presence channels and webhooks

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 soketi:
5 image: quay.io/soketi/soketi:latest
6 container_name: soketi
7 restart: unless-stopped
8 environment:
9 SOKETI_DEFAULT_APP_ID: ${APP_ID}
10 SOKETI_DEFAULT_APP_KEY: ${APP_KEY}
11 SOKETI_DEFAULT_APP_SECRET: ${APP_SECRET}
12 ports:
13 - "6001:6001"
14 - "9601:9601"
15EOF
16
17# 2. Create the .env file
18cat > .env << 'EOF'
19APP_ID=app-id
20APP_KEY=app-key
21APP_SECRET=app-secret
22EOF
23
24# 3. Start the services
25docker compose up -d
26
27# 4. View logs
28docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/soketi/run | bash

Troubleshooting

  • WebSocket connection refused on port 6001: Verify the container is running and port mapping is correct in docker-compose.yml
  • Client authentication fails with 401 errors: Check that APP_ID, APP_KEY, and APP_SECRET environment variables match your client configuration
  • High memory usage and connection drops: Increase Docker container memory limits and implement connection rate limiting
  • Metrics endpoint returns 404 on port 9601: Ensure Prometheus metrics are enabled in Soketi configuration and port is properly exposed
  • SSL handshake failures with WSS connections: Configure proper SSL certificates and verify TLS termination settings
  • Messages not broadcasting to all subscribers: Check channel subscription patterns and verify client-side event listeners are properly registered

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Components

soketi

Tags

#soketi#websocket#pusher#realtime

Category

Message Queues & Brokers
Ad Space