← Portal
System Design

Architecture

Built on a distributed, horizontally-scalable architecture designed for sub-millisecond latency, 99.999% uptime, and millions of concurrent connections.

System Overview

How client connections flow through the wSocket infrastructure

BrowserWebSocketMobile AppWSS / PushBackendREST / WSwSocket BackendNode.js + wsAuth · Channels · PresenceRate Limit · Webhooks · PushRedisPub/Sub BrokerSession CacheMongoDBMessage HistoryAccounts · AnalyticsPush GatewayWeb Push · FCM · APNs
Technology Stack

Built with battle-tested technology

Node.js

Event-driven runtime optimized for high-throughput I/O. Handles thousands of concurrent WebSocket connections per instance.

ws Library

Blazing-fast, production-grade WebSocket implementation for Node.js. Minimal overhead, maximum performance.

Redis

In-memory data store used as a distributed pub/sub broker. Routes messages across server instances in microseconds.

MongoDB

Document database for message persistence, accounts, app metadata, analytics, and webhook configurations.

Message Flow

From publish to delivery in under 5ms — here’s how messages travel through the system

01

Client Publishes

A client sends a message over its WebSocket connection to a specific channel. The server validates auth, rate limits, and channel permissions.

02

Server Processes

The WebSocket handler validates the message, deduplicates it, and routes it to the Channel Manager. If history is enabled, the message is persisted to MongoDB.

03

Broker Distributes

The Redis broker broadcasts the message to all server instances in the cluster. Each instance receives the message via Redis pub/sub in microseconds.

04

Webhook Dispatch

If webhooks are configured, the Webhook Manager sends HTTP callbacks with HMAC-SHA256 signatures to your endpoints with automatic retries.

05

Subscribers Receive

Each server instance delivers the message to locally-connected subscribers on that channel. Delivery happens over WebSocket with zero polling.

Backend Modules

A modular, pluggable architecture where each concern is isolated into its own manager

WebSocket Handler

Manages raw WebSocket connections, protocol framing, heartbeat, and connection lifecycle.

Channel Manager

Channel subscriptions, multiplexing, and fan-out delivery to subscribers.

Auth Manager

JWT token validation, API key verification, and per-channel permission enforcement.

Redis Broker

Distributed pub/sub message routing across all server instances in the cluster.

Presence Manager

Real-time member tracking with custom state data and join/leave events.

Message Store

MongoDB-backed message persistence with TTL, pagination, and time-range queries.

Rate Limiter

Configurable rate limiting per app, per channel, and per user with sliding window algorithm.

Webhook Manager

HTTP webhook delivery with HMAC signatures, retry policies, and event filtering.

Push Manager

Multi-provider push notification delivery: Web Push (VAPID), FCM, and APNs.

Account Manager

User accounts, teams, roles, and dashboard authentication with JWT sessions.

App Manager

Multi-app management, API key rotation, and per-app configuration.

Plan Enforcer

Usage enforcement against plan limits with real-time quota tracking.

Built for Scale

  • Horizontal Scaling

    Add server instances behind a load balancer. Redis broker ensures all instances share messages seamlessly.

  • Connection Multiplexing

    Multiple channels over a single WebSocket connection. No per-channel overhead or connection bloat.

  • Automatic Reconnection

    SDKs handle disconnects with exponential backoff. Clients resume subscriptions without data loss.

  • Message Deduplication

    Built-in dedup layer prevents duplicate delivery in multi-node clusters with at-least-once semantics.

  • Zero-downtime Deploys

    Rolling deployments with connection draining. Clients reconnect to new instances transparently.

< 5ms
P99 Latency
50M+
Connections
99.999%
Uptime SLA
Horizontal Scale

Deploy Anywhere

Run wSocket on your own infrastructure, or use our managed cloud

Self-Hosted Setup

Clone, install, and start the full stack — backend, Redis, and MongoDB.

Managed Cloud

Zero-ops deployment with automatic scaling, monitoring, and global edge nodes.

  • Auto-scaling up to millions of connections
  • Global edge network for low-latency delivery
  • Built-in monitoring and alerting dashboard
  • Automatic TLS certificates and WSS

Explore the full architecture guide

Join developers building the next generation of realtime applications.