Replace EventSource with WebSocket for price streaming
- Switch from SSE EventSource to WebSocket client connecting to btcdata's new /api/price/ws endpoint - Add automatic reconnect on connection loss (3s delay) - Update Dockerfile BTCDATA_URL to use btcdata's new Docker port 4101 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# btcprice
|
||||
|
||||
Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/Tailwind UI. Connects to btcdata for live price data via SSE.
|
||||
Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/Tailwind UI. Connects to btcdata for live price data via WebSocket.
|
||||
|
||||
## Build & Development Commands
|
||||
|
||||
@@ -36,9 +36,9 @@ btcprice's docker-compose includes btcdata via `include: ../btcdata/docker-compo
|
||||
- **Framework:** Kit (Integrant-based)
|
||||
- **Server:** Undertow
|
||||
- **Routing:** Reitit
|
||||
- **Templates:** Hiccup + vanilla JS EventSource
|
||||
- **Templates:** Hiccup + vanilla JS WebSocket
|
||||
- **Styling:** Tailwind CSS v4
|
||||
- **Data backend:** btcdata (separate service at BTCDATA_URL, default http://localhost:4100)
|
||||
- **Data backend:** btcdata (separate service at BTCDATA_URL, default http://localhost:4100, WebSocket at ws://localhost:4100)
|
||||
- **No database** — all data comes from btcdata
|
||||
|
||||
## Source Layout
|
||||
@@ -58,6 +58,6 @@ src/clj/pmagnus/btcprice/
|
||||
│ └── formats.clj # Content negotiation
|
||||
└── routes/
|
||||
├── api.clj # /api routes (JSON)
|
||||
├── ui.clj # UI routes (HTML + EventSource)
|
||||
├── ui.clj # UI routes (HTML + WebSocket)
|
||||
└── utils.clj # Route utilities
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user