Replace SSE price stream with WebSocket, use separate Docker port
- Replace SSE endpoint (/api/price/stream) with WebSocket (/api/price/ws) using ring-undertow-adapter's built-in WebSocket support - Change Docker internal port from 4100 to 4101 to avoid conflicts with local dev (make run still uses 4100) - Add free-port.sh utility script Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# btcdata
|
||||
|
||||
Bitcoin data backend — Clojure Kit application. Fetches BTC prices from Binance WebSocket and Kraken HTTP, stores in PostgreSQL, exposes a JSON API with SSE price stream.
|
||||
Bitcoin data backend — Clojure Kit application. Fetches BTC prices from Binance WebSocket and Kraken HTTP, stores in PostgreSQL, exposes a JSON API with WebSocket price stream.
|
||||
|
||||
## Build & Development Commands
|
||||
|
||||
@@ -44,7 +44,7 @@ Docker runs alongside local dev on different ports and databases:
|
||||
## API Endpoints
|
||||
|
||||
- `GET /api/health` — Health check
|
||||
- `GET /api/price/stream` — SSE stream with JSON price updates
|
||||
- `GET /api/price/ws` — WebSocket endpoint for live JSON price updates
|
||||
- `GET /api/price/latest` — Latest price as JSON
|
||||
|
||||
## Source Layout
|
||||
@@ -67,6 +67,6 @@ src/clj/pmagnus/btcdata/
|
||||
│ ├── exception.clj # Exception handling
|
||||
│ └── formats.clj # Content negotiation
|
||||
└── routes/
|
||||
├── api.clj # /api routes (JSON + SSE)
|
||||
├── api.clj # /api routes (JSON + WebSocket)
|
||||
└── utils.clj # Route utilities
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user