Websocket Server in Golang
·
SI THU AUNG
I built a WebSocket server in Go called gocket. It speaks the Pusher protocol, so it works as a drop-in replacement for Pusher or Soketi on the Laravel side — no client changes needed.
https://github.com/sithuaung/gocket
What it does
- Full Pusher protocol: connect, subscribe, unsubscribe, ping/pong
- Public, private, presence, and encrypted channels
- Client events (
client-*) on private and presence channels - Pusher-compatible HTTP API (
/events,/batch_events,/channels) - HMAC-SHA256 auth compatible with Laravel
- Webhooks with batching
- Multi-app support
- Per-connection and per-app rate limiting
- Origin checks, TLS, graceful shutdown, health and stats endpoints
Benchmarks
Ran on a small DigitalOcean droplet (1 CPU, 2 GB RAM) with 100 concurrent subscribers:
| Metric | Value |
|---|---|
| Throughput | 3,750 msgs/sec |
| Median delivery latency | 8 ms |
| p95 delivery latency | 33 ms |
| Median HTTP publish | 3.19 ms |
I compared the load test results against Soketi and they perform roughly the same on a single CPU. Gocket pulls ahead on larger servers, since Go scales naturally across multiple cores.