The connection to the streaming endpoint will result in an HTTP persistent connection, or a standard HTTP request that will end the connection after having finished the data requested when using batch mode.
The server will keep sending messages until the connection terminates. The client can reconnect and resume consuming the messages from the last known position token. The position token is sent in short intervals as part of the Target Updates stream.
Note that while a single HTTP connection in streaming mode may persist for long periods without termination, code to support automatic reconnection using the last known position token is highly recommended for customer usage in production.
If live target updates are not essential for your use case, then streaming mode can also be used with a four hour delay. This otherwise behaves exactly the same and will work with the API request shared above. Please speak to the Spire team if this might be of interest.
In batch mode, the server will only send the target updates between the desired dates and then stop the connection.
To activate Batch mode, you simply need to use the query parameters
end in your query parameters.
The following parameters can be specified to filter the stream on the server-side or to reduce the bandwidth requirements. Since these are query parameters the total number of filters that can be specified is limited by the maximum URL length. All query parameters are optional, if not specified then all the data is sent to the stream.
|string||Comma separated list of ICAO addresses (6 hex characters)|
|string||Comma separated list of tail numbers|
|string||Comma separated list of flight numbers|
|string||Comma separated list of callsigns|
|string||Comma separated list of airline IATA codes|
|float,float||Two numbers, separated by a comma. First value must be smaller than the second; specifies south-to-north range. First value is inclusive, last value is exclusive|
|float,float||Two numbers, separated by a comma. Specifies west-to-east range. E.g. range [170, -170) is a 20° range crossing anti-meridian, and [-170, 170) is a 340° range covering most of the globe. First value is inclusive, last value is exclusive|
|integer,integer||Altitude in ft, two integers separated by a comma. First value is inclusive, last value is exclusive|
|integer||This filters out delayed data. If an aircraft timestamp is older than n milliseconds, the target update will not be returned|
|string||Compression of the data.|
Adding those parameters will automatically enable batch mode.
|datetime||Batch mode data extraction starting date, format is in ISO 8601|
|datetime||Batch mode data extraction ending date, format is in ISO 8601|