Self-hosted WebSockets & push notifications in pure Go
APS (Aadhan Pradhan Services) gives you everything Pusher Channels and Pusher Beams provide — without per-connection caps, monthly message meters, or per-device pricing. Point your existing client SDKs to your own server and run real-time events for free.
$docker run -p 8080:8080 -p 3000:3000 ghcr.io/khajumsanjog/aps:latest
Starts the Go WebSocket engine on port :8080 and the Developer Console on :3000. Zero config or database setup needed to test locally.
The 2-Line Drop-in Migration
APS speaks the exact wire protocol of Pusher. You keep your existing client and server code, packages, and hooks — only two configuration lines change.
import Pusher from 'pusher-js';
const pusher = new Pusher('YOUR_APP_KEY', {
- cluster: 'mt1',
- forceTLS: true
});
const channel = pusher.subscribe('orders');
channel.bind('order:created', (data) => {
renderOrder(data);
});
import Pusher from 'pusher-js';
const pusher = new Pusher('aps_key_demo_12345', {
+ wsHost: 'aps.yourcompany.com', // Your self-hosted domain
+ wsPort: 443, // Handled via SSL reverse proxy
enabledTransports: ['ws', 'wss'],
forceTLS: true
});
const channel = pusher.subscribe('orders');
channel.bind('order:created', (data) => {
renderOrder(data);
});
What APS Actually Does
Six core components designed to give you complete independence from third-party real-time subscription services.
APS Channels (WebSockets Engine)
Complete drop-in replacement for Pusher Channels. Supports public broadcast feeds, private authenticated channels with HMAC-SHA256 signatures, presence channels with real-time member online/offline state, and client-side AES-GCM encrypted payloads. Also includes an optional message replay buffer (/history) so reconnecting clients never lose messages.
APS Beams (Push Notification Daemon)
A unified push daemon that reaches mobile devices when apps are closed or asleep. Direct integration with Firebase Cloud Messaging (FCM HTTP v1) for Android & Web Push, and Apple Push Notification service (APNs) for iOS. Publish to topic interests or target authenticated user IDs directly with zero per-device fees.
Next.js 16 Developer Console
A modern web control plane included in the stack. View live streaming WebSocket events in real time, inspect connection graphs, test mobile push notifications with custom JSON payloads, rotate application keys and secrets, and review webhook delivery logs with dead-letter retries.
Dedicated apsctl CLI Tool
Built for terminal-first developers and automation pipelines. Run apsctl status to verify cluster node health, apsctl tail to stream live channel events directly in your terminal, apsctl trigger to send mock events, and apsctl push to test push delivery without writing custom scripts.
Standalone In-Memory or Clustered Scale
Two deployment architectures in a single binary:
• Standalone Mode: Uses Go's internal synchronization and channels. Zero external databases required, boots in 2ms, idles under 35MB RAM, and handles 50,000+ connections on a $5 VPS.
• Clustered Mode: Turn on Redis 7 pub/sub for multi-node event synchronization behind a load balancer, with PostgreSQL 16 for persistent app keys and webhook history.
Zero Custom Client SDKs Required
Because APS implements the standard Pusher wire specification, you never rely on custom, unmaintained third-party client wrappers. Use the official, production-tested Pusher client SDKs across Web, iOS (Swift), Android (Kotlin), Flutter, Python, Go, Node.js, and PHP Laravel Broadcasting.
Interactive Broadcast Simulator
Experience the sub-millisecond dispatch loop right in your browser. Send an event and watch the WebSocket log update.
POST /apps/100001/events) is dispatched. The Go hub matches active subscribers on that channel and broadcasts the framed event to all connected WebSocket clients in ~0.3ms.
Code Examples by Language
Standard Pusher packages with customized host configuration. Select your stack below:
How APS Compares
An honest engineering comparison: trade a steep SaaS subscription bill for lightweight self-hosted infrastructure.
| Feature / Capability | APS (Self-Hosted) | Pusher Channels | Ably | Socket.io |
|---|---|---|---|---|
| Monthly Connection Limits | Unlimited (Hardware-bound) | Strict limits per tier (200k max) | Pay-per-connection | Unlimited |
| Monthly Message Quotas | Unlimited (0 limits) | Metered per million | Metered billing | Unlimited |
| Pusher Protocol Compatible | Yes, 100% native | Yes | No — requires Ably SDK | No — requires Socket.io client |
| Mobile Push Engine (Beams) | Built-in (FCM + APNs) | Separate paid product | Separate integration | Not included |
| Admin Developer Console | Included (Next.js 16) | Cloud dashboard | Cloud dashboard | Not included |
| Terminal CLI Utility | Included (apsctl) |
None | Beta CLI | None |
| Hosting Cost for 100k Users | ~$10–20/month (VPS) | $1,199+/month | $1,500+/month | ~$20/month, self-managed |
How a Message Actually Moves
Four sequential hops from client emission to recipient delivery, explained step by step.
Reverse Proxy & Handshake
Web clients, mobile apps, or IoT hardware open standard WebSocket connections (wss://). A reverse proxy (Caddy or Nginx) terminates SSL/TLS on port 443 and passes the upgrade to APS on port 8080.
HMAC Signature & Binding
For private or presence channels, the client provides an auth token computed with your app secret (HMAC-SHA256). APS verifies the signature, registers the connection, and binds it to the requested channel.
Sub-Millisecond Dispatch
When your backend triggers an event, Go goroutines broadcast the payload across connected sockets in <0.5ms. In clustered mode, Redis 7 Pub/Sub immediately replicates the event to all neighboring cluster nodes.
Asynchronous Push Queue
If the broadcast targets mobile devices via APS Beams, background worker pools deliver notifications to Google Firebase FCM (Android) and Apple APNs (iOS) asynchronously without stalling real-time WebSockets.
Download & Deployment Options
Pick the deployment path that matches your infrastructure: pre-compiled binary, Docker Compose, or Go source.
Pre-compiled Binaries
Static Go executables with zero external runtime dependencies. Download, grant execution permissions, and run.
Docker & Compose Stack
Official multi-arch container image plus a complete production Compose stack with Caddy, PostgreSQL, and Redis.
docker pull ghcr.io/khajumsanjog/aps:latest
docker compose up -d (full stack)
Build from Go Source & CLI
Install the apsctl control CLI directly or build the server binary locally using Go 1.26+.
Frequently Asked Questions
Practical answers to common architecture, migration, and infrastructure questions.
pusher-js, PusherSwift, pusher-java-client, and pusher_channels_flutter work out-of-the-box without modification. You simply configure wsHost and wsPort during client initialization.
/app/*) and REST calls (/apps/*, /beams/*) directly to APS running locally on port 8080.