Streaming
SSE and WebSocket streams, channels, and the limits a long-lived connection lives under.
Server-sent events
curl -N 'https://astra.preview.avee.tech/v2/updates/price/stream?ids[]=<id>&ids[]=<id>&channel=real_time'Each event is one PriceUpdate for one feed. The last value of each feed is sent on connect, and a
: keepalive comment arrives every 30 seconds.
WebSocket
Connect to wss://astra.preview.avee.tech/ws (add ?channel=… to pick a channel) and send the Hermes messages:
{"type": "subscribe", "ids": ["<id>"], "verbose": false, "binary": false}Each subscribe or unsubscribe is answered with {"type":"response","status":"success"} or an
error, then the last value of each feed arrives as:
{"type": "price_update", "price_feed": {"id": "<id>", "price": {}, "ema_price": {}}}The server pings every 30 seconds.
Channels
| Channel | Behaviour |
|---|---|
real_time | Every update. |
fixed_rate@200ms | At most once per 200 ms per feed, only when it changed. |
fixed_rate@1000ms | The default. At most once per second per feed, only when it changed. |
fixed_rate@50ms is refused with 400. Per feed, a stream is always in publish_time order and
never repeats an update, so allow_unordered and allow_out_of_order are accepted and change
nothing. benchmarks_only=true sends only the first update of each second.
Limits
- Send at most 200 IDs per request. The server accepts up to 500, but longer URLs are rejected
before they reach Astra:
414over HTTP/1.1, a framing error over HTTP/2. For more feeds, use several requests, or subscribe over WebSocket, where IDs travel in the message body (up to 500 persubscribe). The SDKs do this for you: REST reads are split into requests of 200, and an SSE subscription over 200 IDs is refused with a hint to use thewstransport. - Historical routes take at most 100 distinct feeds, and a candle request at most 5000 bars.
- Per client address there is a request rate and a cap on concurrent streams. Over either, the
answer is
429withRetry-After. - Streams close after 24 hours, as on Hermes: reconnect.
- A WebSocket message is at most 64 KiB. A socket that sends too many messages, or stops reading
until its buffer fills, is closed with code
1008. - A restarting server ends streams (WebSocket
1001) and refuses new ones with503: reconnect.