CommunicationLive

Real-time & Communication

A group chat built around temporary rooms: create an account, join or create a room via a link, and chat with up to 10 people in real time. Every room expires on its own 7 days after creation, with nothing left behind. Messages are stored encrypted (AES-256-GCM) in the database.

Realtime Chat WebSocket Server-Sent Events Java Spring Boot Redis JWT

Technologies

  • Java 21
  • Spring Boot
  • Spring WebSocket
  • Spring Security
  • JJWT
  • PostgreSQL (Supabase)
  • Redis
  • BCrypt
  • Server-Sent Events
  • AES-256-GCM encryption

Architecture

  • Next.js frontend consuming an external Java API
  • plain WebSocket for the room chat (one connection per room)
  • per-user Server-Sent Events to announce new messages in any of their rooms
  • Redis Pub/Sub across instances
  • messages encrypted with AES-256-GCM before they are stored
  • short-lived access JWT with a rotating refresh token
  • cross-origin session cookie
  • room expiry driven by a database timestamp — not a token

Concepts

  • WebSocket lifecycle
  • EventSource and automatic reconnection
  • browser notifications (Notification API)
  • Redis Pub/Sub across instances
  • online presence via TTL
  • JWT with rotating refresh tokens
  • cross-origin session cookies
  • data expiry via scheduled job
  • relational modeling of rooms and members
  • message encryption at rest (AES-GCM)

Demo area

The demo is 100% functional — try it now.