Real-time feed
A Go WebSocket fan-out for prices, balances and swaps.
- Stack
- GoWebSocketsRedis pub/subCaddy
Everything live in Boba — prices, balances, notifications, wallet and KOL swaps, XP and gas — reaches the app through one Go service that fans WebSocket messages out on top of Redis pub/sub.
Decisions
Do the work once per channel, not once per client
The feed subscribes to each Redis channel exactly once, however many clients want it. On a busy channel, each message is compressed once and the same frame goes to every subscriber. Redis load scales with channels, not connections.
Sequence numbers, so gaps are never silent
Every message carries a monotonic sequence number within its channel. A client sees a gap the moment it happens and recovers, instead of quietly showing stale prices.
What I built
- Validates the JWT itself and only lets a user subscribe to their own channels, like
balance.{userId}. - Channels for live prices (
portfolio.price.{chain}.{token}), balances, notifications, tracker and KOL swaps, hot tokens, XP updates and gas prices. - Per-client caps on channels and subscribes per second.
- Sits behind Caddy, which passes WebSockets straight through with one connection per client and forwards the real client IP for rate limiting.