Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 3.07 KB

README.md

File metadata and controls

38 lines (25 loc) · 3.07 KB

pump1090

Overview

pump1090 is a simple Rust program that provides one function: it reads and parses dumpfile JSON files generated by dump1090 and pipes them to a specified WebSocket endpoint.

Theoretically, pump1090 could work with any server with a WebSocket endpoint that doesn't need authentication, but was designed to work with serve1090 within the roob1090 stack.

piaware is a better-known and feature complete example of software that does the exact same thing, but piaware runs on Debian-like Linux only and is specifically made to send dumpfile data to FlightAware. piaware and pump1090 will run just fine in concert.

This program would probably have been much easier to write in Python or some other scripting language, but where's the fun in that? It was a nice introduction to learning Rust.

Prerequisites

  1. At least cargo and rustc 1.42.0-nightly
  2. A running instance dump1090 and generating the requisite dump JSON files

Installation

  1. For a development run, cargo run or cargo run -- -f shortArg --long longArg
  2. For a release (optimized) run, cargo run --release -- -f shorgArg --long longArg
  3. For help, cargo run -- --help
  4. For documentation, run cargo doc and open target/doc/pump1090/all.html

Arguments

pump1090 needs three inputs to operate properly. It will first check for a .env file containing the necessary arguments, will next check for command line arguments, and will finally use the default values specified in the source code.

Name Description .env var name CLI arg name Default value
Device ID A string identifying the machine on which pump1090 is running DEVICE_ID -s, --id undefined
serve1090 token Token (PUMP_KEY in serve1090) for the serve1090 instance accepting the dumpfile data SERVE1090_TOKEN -t, --token undefined
Dumpfile path Path to the JSON file generated by dump1090 DUMPFILE_PATH -d, --dumpfile data/aircraft.sjon
WebSocket endpoint URL of the WebSocket endpoint to send dump1090 data WS_ENDPOINT -e, --endpoint ws://localhost:3000/pump

Remarks

pump1090 is relatively resilient against failure. It will automatically attempt to establish a connection with the WebSocket endpoint every 5 seconds. If connection with the endpoint is lost during the pumping process, pump1090 will re-enter the "establish" mode, retrying the endpoint until a successful connection is made.

There is no file watching structure in place--the dumpfile is automatically parsed and piped to the endpoint every half second. File watching proved to be very complicated to implement with resilience, especially across the Linux/Darwin platforms and cross-platform support for things like fsevents, with marginal performance gain.