Skip to content

chore: live-data example WebSocket host (ws → addToDataset) - #3687

Merged
igorDykhta merged 3 commits into
masterfrom
igr/add-websocket-example
Sep 2, 2026
Merged

chore: live-data example WebSocket host (ws → addToDataset)#3687
igorDykhta merged 3 commits into
masterfrom
igr/add-websocket-example

Conversation

@igorDykhta

@igorDykhta igorDykhta commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a WebSocket mode to the live-data example. Kepler.gl is not a websocket client: the host app opens ws://localhost:4010/vehicles.ws and maps each JSON upsert to addToDataset(..., {upsertBy: 'id'}). Three ws-* points move on a 20s loop; layer id and style stay put. Kepler still rebuilds layer data on every message (no incremental deck path).

Related issues

  • #322 — realtime / websocket transport. This PR documents the host-app pattern (ws → addToDataset). It does not add a Kepler websocket client, a streaming dataset type, or a cheaper layer rebuild. render realtime data coming from websocket for example #322 stays open for incremental deck updates.
  • #176 — uses the row-table addToDataset / upsert-by-id API (already landed). DuckDB/Arrow in-place edits are out of scope.
  • #3667 (merged) — HTTP snapshot poll. Different path; the example still toggles Poll URL vs host edits vs WebSocket.

This PR does not close #322 or #176.

Test plan

  • Restart yarn start:live-data, wait for the 3 CSV points, switch to WebSocket
  • Row count goes 3 → 6; ws-01ws-03 keep moving; ids do not keep growing
  • Sidebar shows socket open and a rising message count
  • Poll URL closes the socket and restores the 3 orbiting CSV vehicles

Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
Copilot AI lite review requested due to automatic review settings September 1, 2026 14:09
@igorDykhta igorDykhta changed the title chore: add websocket mode to live-data example chore: live-data example WebSocket host (ws → addToDataset) Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a WebSocket-based “live updates” mode to the examples/live-data host app, demonstrating the “transport pattern” of mapping ws messages into addToDataset (without making kepler.gl itself a WebSocket client).

Changes:

  • Add a minimal Node WebSocket hub (upgrade handling + periodic JSON broadcast) to the live-data CSV server.
  • Add a new “WebSocket” mode to the live-data example UI that connects to LIVE_WS_URL and upserts incoming rows via addToDataset.
  • Update example docs and changelog to describe the new mode and configuration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/README.md Updates the examples index to mention the new WebSocket mode in Live Data.
examples/live-data/websocket.mjs New minimal WebSocket hub implementation used by the live-data server.
examples/live-data/src/app.tsx Adds “WebSocket” UI mode and client-side mapping from WS messages to addToDataset.
examples/live-data/server.mjs Serves a WS endpoint alongside CSV and broadcasts periodic JSON upserts.
examples/live-data/README.md Documents the new WebSocket mode behavior and intent (transport pattern).
examples/live-data/esbuild.config.mjs Injects process.env.LIVE_WS_URL for the example build.
CHANGELOG.md Notes the new live-data example WebSocket mode in Unreleased.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/live-data/websocket.mjs
Comment thread examples/live-data/websocket.mjs
Comment thread examples/live-data/server.mjs Outdated
@igorDykhta
igorDykhta requested a review from lixun910 September 1, 2026 14:17
Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
@igorDykhta igorDykhta self-assigned this Sep 2, 2026
@igorDykhta
igorDykhta merged commit 878d965 into master Sep 2, 2026
7 checks passed
@igorDykhta
igorDykhta deleted the igr/add-websocket-example branch September 2, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render realtime data coming from websocket for example

3 participants