koala73 / koala73/worldmonitor

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

Open
#1,227 3 comments 2 reactions 0 assignees View on GitHub
area: API feature High Value
Dominant language
TypeScript
Stars
86.6k
Forks
13.1k
Avg merge
8h 4m
Merged PRs (30d)
825

Description

## 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

Contributor guide

Open the contributing guide

Research direction

Start with SmartPollLoop in src/services/runtime.ts, the Railway relay in scripts/ais-relay.cjs, and the existing wm:breaking-news CustomEvent pattern. First determine the implementation scope for browser SSE and each listed feed; done should mean the agreed real-time delivery path is defined and the deferred polling behavior is replaced where applicable.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.