Server-Sent Events (SSE)

Info

Draft Documentation - This section is currently under review and may be subject to changes.

Server-Sent Events (SSE) Endpoints

This section displays the Server-Sent Events (SSE) implementation for real-time player notifications. SSE provides a one-way communication channel from the server to the client, enabling instant delivery of notifications and updates without the need for polling.

Service: go_gateway Protocol: HTTP with text/event-stream content type

Overview

The SSE system allows players to maintain a persistent connection to receive real-time events as they occur. Events are published via Redis Pub/Sub and delivered to all connected clients subscribed to the player’s event stream.

Features

  • Real-time Delivery: Instant notification delivery as events occur
  • Connection Management: Automatic keep-alive heartbeats every 15 seconds
  • Multi-tenant Support: Separate event channels per brand and player
  • Scalability: Connection limit configuration (default: 50,000 concurrent connections)
  • Resilience: Automatic reconnection handling and buffered event delivery
  • Event Types: Extensible event system supporting various notification types

Architecture

Client → SSE Connection → Gateway → Redis Pub/Sub → Event Publishers

Event Channel Pattern: SSE::{brand_id}::{player_id}

Available Operations

  • GET - Establish SSE connection and receive real-time events

Event Types

The SSE system currently supports the following event types:

  • notification - In-app notifications (bonuses, promotions, account updates)

Additional event types can be added as the platform evolves.

Connection Lifecycle

  1. Client initiates SSE connection with authentication token
  2. Gateway validates brand and player authentication
  3. Initial “connected” event sent to client
  4. Event subscription established to Redis channel
  5. Keep-alive heartbeats sent every 15 seconds
  6. Events published to Redis are immediately forwarded to client
  7. Connection remains open until client disconnects or error occurs

Configuration

Parameter Default Description
SSE_CONNECTION_LIMIT 50000 Maximum concurrent SSE connections
EVENTS_REDIS_STORAGE - Redis host for SSE event publishing
keepAlivePeriod 15s Heartbeat interval for connection health
eventChannelBufferSize 50 Event buffer size for burst handling