Skip to main content

Streaming Subscriptions

Rolling out

Streaming subscriptions are being rolled out. Limits may change before general availability.

Subscribe to live messages from across the Airframes network, filtered to what you care about. The same subscriptions and limits are available over WebSocket (Socket.IO) and MQTT. Station, aircraft, label and message-type filters work on both; airline, flight and region filters are WebSocket only.

Your own stations are always included​

On every plan, including Free, you can subscribe to your own stations' messages, and it never counts against your plan. A subscription is an own-station subscription when it has a stations filter and every value in it is a station you own (ident or numeric id). Other fields, such as tails or labels, only narrow it further, so { "stations": ["YOUR-STATION"], "tails": ["N123AB"] } is still an own-station subscription. It does not use your plan's connections, subscriptions per connection, messages per second or usage figures, and it works over WebSocket and MQTT even if your plan includes neither. Abuse limits still apply: up to 10 connections and 50 own-station subscriptions per connection.

A subscription whose stations list also names someone else's station, or that has no stations filter at all, is checked against your plan as usual. If a station stops being yours, its subscriptions end with stream:unsubscribed and reason not_your_station.

The original own-station WebSocket feed also still works on every plan; see Realtime / Streaming.

What your plan includes​

FreeFeeder Pro / ProBusinessEnterprise
WebSocket subscriptions—✓✓✓
MQTT——✓✓
Connections at once—25Custom
Subscriptions per connection—1050Custom
Values per filter field—25250Custom
Filter by aircraft, flight, station—✓✓✓
Filter by airline, label, region——✓✓
Full network firehose———✓
Messages per second (burst)—20 (100)100 (500)Custom

Limits apply per account. Connections are counted across WebSocket and MQTT together. None of these limits apply to your own stations.

Filters​

A filter is a JSON object. Every field you include must match, and within a field any listed value may match.

{ "tails": ["N123AB", "N456CD"], "labels": ["H1", "80"] }

That filter matches label H1 or 80 messages from either of the two aircraft.

FieldMatchesPlans
stationsStation ident or numeric idPro and up, or any plan for your own stations
tailsAircraft registrationPro and up
flightsFlight numberPro and up
icaosICAO 24-bit hex addressPro and up
airlinesAirline ICAO codeBusiness and up
labelsACARS labelBusiness and up
region[minLon, minLat, maxLon, maxLat], up to 10° per side on Business. Matches only messages that carry a position.Business and up
sourceTypesMessage type, for example ACARSEnterprise
(empty filter)EverythingEnterprise

A filter is judged by its most specific field. { "tails": ["N123AB"], "labels": ["H1"] } is available on Pro, because it is narrowed to one aircraft. Values are case-insensitive.

WebSocket​

Connect with your API key as described in Realtime / Streaming, then subscribe:

import { io } from 'socket.io-client';

const socket = io('wss://ws.airframes.io', {
transports: ['websocket'],
auth: { apiKey: 'YOUR_API_KEY' },
});

socket.on('connect', () => {
// Subscriptions do not survive a reconnect. Send them again on every connect.
socket.emit('stream:subscribe', {
id: 'my-fleet',
filter: { tails: ['N123AB', 'N456CD'] },
});
});

socket.on('stream:subscribed', ({ id, class: breadth }) => {});
socket.on('stream:message', ({ subscriptions, message }) => {
// subscriptions: ids of your subscriptions that matched
// message: a Message object, same shape as GET /v1/messages/:id
});
socket.on('stream:error', ({ code, message, upgradeTo }) => {});
socket.on('stream:throttled', ({ dropped, ratePerSecond }) => {});

A message that matches several of your subscriptions is delivered once, with every matching id listed.

Events​

DirectionEventPayload
Client → serverstream:subscribe{ id?, filter }. Re-using an id replaces that subscription.
Client → serverstream:unsubscribe{ id }
Client → serverstream:statusnone
Server → clientstream:subscribed{ id, filter, class, subscriptions, maxSubscriptions }
Server → clientstream:unsubscribed{ id, removed }, or { id, reason } with reason plan_changed or not_your_station
Server → clientstream:message{ subscriptions: string[], message }
Server → clientstream:status{ plan, limits, delivered, dropped, subscriptions }
Server → clientstream:throttled{ dropped, droppedTotal, ratePerSecond, plan }
Server → clientstream:error{ code, message, id?, limit?, upgradeTo? }

MQTT​

Available on Business and Enterprise. On any plan you can also use MQTT for your own stations, with airframes/v1/messages/+/YOUR-STATION/# or airframes/stations/YOUR-STATION/messages (or airframes/stations/+/messages for all of them).

  • Host and port: published here when MQTT subscriptions launch. The examples below use MQTT_HOST as a placeholder.
  • Encryption: connect over TLS. Your API key is the password, so never send it over a plain connection.
  • Password: your API key. Any username is accepted.
  • Protocol: MQTT 3.1.1, QoS 0, clean sessions only. Publishing is not allowed.

Messages are published on:

airframes/v1/messages/{sourceType}/{station}/{tail}/{label}

The airframes/v1/messages prefix is lower-case and topic matching is case-sensitive. The four variable levels ({sourceType}, {station}, {tail}, {label}) are upper-case, and a missing value is -. Filter with the usual MQTT wildcards:

Topic filterReceivesPlans
airframes/v1/messages/+/+/N123AB/#One aircraftBusiness and up
airframes/v1/messages/+/KE-KSFO1/#One stationBusiness and up, or any plan if it is your station
airframes/v1/messages/+/+/+/H1One labelBusiness and up
airframes/v1/messages/ACARS/#One message typeEnterprise
airframes/v1/messages/#EverythingEnterprise
airframes/stations/YOUR-STATION/messagesOne of your own stations (same messages as the v1 topic)Any plan, own stations only
airframes/stations/+/messagesAll of your own stationsAny plan, own stations only
# 8883 is the standard MQTT-over-TLS port; --capath enables certificate checks.
mosquitto_sub -h MQTT_HOST -p 8883 --capath /etc/ssl/certs \
-u feed -P "YOUR_API_KEY" \
-t "airframes/v1/messages/+/+/N123AB/#"

A subscription your plan does not allow is refused (SUBACK failure). The reason is sent to your connection on the topic airframes/v1/notices, which also carries stream:throttled notices. The gateway publishes these straight to your connection rather than through a subscription, and a subscription to that topic is refused. Clients such as mqtt.js hand them to the normal message callback. If your client library discards messages that match none of its subscriptions, you will not see notices, so rely on the SUBACK result to detect a refusal.

Airline, flight and region filters are available over WebSocket only, because they are not part of the topic.

Delivery guarantees​

Streaming is live and at most once.

  • Nothing is stored for you while you are disconnected, and there is no replay.
  • If messages arrive faster than your plan's rate, the extra messages are dropped, and a stream:throttled notice with the count is sent at most once every ten seconds. Over MQTT this notice arrives on airframes/v1/notices as described above, so a client that discards unmatched messages will not see it.
  • If your client stops reading for about 30 seconds, it is disconnected with slow_consumer.
  • A plan change applies within a few minutes without a reconnect. On a downgrade, subscriptions your new plan does not allow are removed and you are told which. Subscriptions to your own stations are kept.

For complete capture, use the REST API or a bulk export.

Error codes​

CodeMeaning
auth_requiredConnect with an API key first.
plan_requiredYour plan does not include this stream.
connection_limitYou have reached your plan's concurrent connections.
subscription_limitYou have reached your plan's subscriptions per connection.
filter_too_broadNarrow the filter, or upgrade to the plan in upgradeTo.
too_many_valuesToo many values in one filter field.
region_too_largeThe region box is larger than your plan allows.
invalid_filter, invalid_id, invalid_topicThe request is malformed.
rate_limitedToo many subscription changes in a minute.
slow_consumerDisconnected because the client was not keeping up.

Your usage​

GET /v1/user/data-feeds/streaming returns your plan's limits and hourly usage (messages, bytes and dropped messages). The same figures are shown under Settings → Integrations.