wss://api.enhancedradar.com/api/v0/live
Opens one WebSocket for live updates. Subscribe to as many topics as you need on the same connection, and unsubscribe when you no longer want one. Send the API key on the WebSocket upgrade request. The key is checked once, when the connection opens.
Messages
Every message in either direction is one JSON text message.1
Subscribe
Send The server answers with
subscribe with a subscription_topic and the topic’s params:subscribed and the subscription_id it assigned:2
Receive updates
Each update for that subscription arrives as
update, with the topic’s payload in data and what the message cost in charged_usd and balance_usd:3
Unsubscribe
Send
unsubscribe with the subscription_id. The server answers with unsubscribed; no more updates for that subscription are sent after it.unsubscribed message that has error and no request_id:
error. The connection stays open, and other subscriptions are not affected.
Client messages
string
required
subscribe or unsubscribe.string
A UUID you generate is recommended, but any string is accepted; it is copied into the reply so you can match the two.
string
With
subscribe: transcripts, events, flight_status, airport_status, or pireps.object
With
subscribe: the topic’s parameters. Numbers are JSON numbers and lists are JSON arrays. Unknown parameters are rejected.string
With
unsubscribe: a subscription_id from a subscribed reply on this connection.Server messages
string
subscribed, update, unsubscribed, or error.string
The
request_id of the client message this replies to. Absent on update, on an unsubscribed the server sends when it ends a subscription, and when the client sent none.string
The subscription the message is about. On
error, the subscription_id the client sent, if any.string
The subscription’s topic.
object
On
update only: the topic’s payload, described under each topic.string
On
update: what this message cost, in US dollars with three decimal places, e.g. "0.150".string
On a billed
update: the organization’s balance after this charge, in the same format. Omitted for a first flight_status update whose status is null, which is not billed.string
On
error: what was wrong, e.g. a missing or invalid parameter, a refused charge, or a failure on our side; retry those later. On an unsubscribed the server sends when it ends a subscription: why it ended it.Topics
Billing
Opening a connection and subscribing are free. Each update sent is charged at the price of its topic:
The first update of
flight_status and airport_status is charged when you subscribe; if that charge is refused, the server answers with error instead of subscribed. If the charge for a later update is refused, that subscription ends: the server sends unsubscribed with an error that says why. Each update reports what it cost in charged_usd and, when billed, the balance after it in balance_usd. The upgrade response does not report the cost of later updates. See Pricing and Billing.
Behavior
The server handles client messages one at a time, in the order they arrive, and replies to each before reading the next. Asubscribe that has to prepare a search or load a status can take a few seconds. Once subscribed is sent, updates for that subscription can arrive at any time, interleaved with updates for other subscriptions and with replies.
- Subscriptions belong to the connection. When the connection closes, every subscription on it ends; after reconnecting, subscribe again.
- Updates are not acknowledged, and there is no backfill: only what happens after a subscription starts is sent.
- A client that falls 256 messages behind across all its subscriptions, or that does not accept a message within one second, is disconnected and should reconnect.
- The server sends no messages of its own while nothing matches.
- An idle connection can be closed by the network between you and the API. Send a WebSocket ping at least every 30 seconds; the server answers each ping with a pong.
- A client message over 4 KiB closes the connection.
401 or 403 as described in Errors; everything after that is reported with error messages.