Skip to content

Real-time streaming: SSE/WebSocket push for breaking news and alerts #1227

@maxwangsongyuan

Description

@maxwangsongyuan

Summary

Upgrade from HTTP polling to Server-Sent Events (SSE) for real-time push of breaking news, alerts, and data updates to the browser.

Current State

All browser-to-backend communication uses HTTP polling via SmartPollLoop:

  • Telegram Intel: 60s polling
  • OREF Alerts: 120s polling
  • RSS News: 15min polling
  • AIS Vessels: 5min polling (WebSocket upstream exists on Railway relay, but frontend polls HTTP)

Proposed Architecture

Railway relay ──SSE──→ Browser
  - Breaking news alerts (instant push)
  - OREF alerts (instant push)
  - AIS position updates (near real-time)
  - Telegram intel (reduced latency)

Why SSE over WebSocket

  • Unidirectional (server→client) is sufficient
  • HTTP compatible (works with Vercel Edge)
  • Native EventSource API in browsers
  • Auto-reconnect built in

Priority

Deferred — current polling intervals are acceptable for MVP. Real-time push becomes important when:

  • User count increases (polling doesn't scale)
  • Breaking news latency matters (15min RSS delay is too slow)
  • AIS tracking needs sub-minute updates

Related

  • Design discussion in session 2026-03-07
  • SmartPollLoop in src/services/runtime.ts
  • Railway relay in scripts/ais-relay.cjs
  • Breaking news events: wm:breaking-news CustomEvent pattern already exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    High ValueMeaningful contribution to the projectenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions