back to archive
case_study.mdMay-Sept 2024
Hiky - Real-time Messaging screenshot

Hiky - Real-time Messaging

Built a real-time messaging platform with React.js and Node.js, achieving sub-100ms latency using WebSockets and Redis Pub/Sub for scalable cross-instance communication.

React.jsNode.jsWebSocketsRedisJWT/PASETO
problem

A single-instance WebSocket server can't scale horizontally on its own — a message sent by a client connected to instance A needs to reach a recipient connected to instance B without a shared broker in between.

architecture decisions
  • 01Redis Pub/Sub as the cross-instance message bus: each server instance subscribes to relevant channels and republishes incoming WebSocket messages, so horizontal scaling doesn't break delivery.
  • 02React.js client maintaining a persistent WebSocket connection with reconnection/backoff handling for flaky networks.
  • 03JWT/PASETO-based auth on the WebSocket handshake, avoiding an unauthenticated socket that only gets checked after the first message.
my contribution

Built the Redis Pub/Sub fan-out layer connecting multiple Node.js instances and the reconnection logic on the client that keeps message delivery consistent across drops.

other builds