hafas-monitor-departures 🔭
Pass in a HAFAS client, fetch all departures at any set of stations. (You may get blacklisted.)
If you want to monitor trips/departures in an area, use hafas-monitor-trips
. It polls HAFAS more efficiently.
Installing
npm install hafas-monitor-departures
Usage
As an exampe, we're going to use vbb-hafas
, the HAFAS client for Berlin.
const createMonitor = const createHafas = const stations = '900000100003' // array of station idsconst interval = 2 * 60 * 1000 // every two minutesconst duration = 10 // each time, fetch departures for the next 10 min const hafas = const monitor = monitormonitor
hafas.departures()
must be compatible with the implementation of hafas-client@5
(or of hafas-client@^4
).
Once you listen to any of the departure
or stats
events, it will automatically start to watch, and stop once you stop listening.
To manually issue a single departures check at a station, use monitor.manual(id)
. The result will be emitted in a data event like all others.
API
opt
overrides the following default values:
interval: interval || 60 * 1000 step: step || Math duration: duration || Math
Related
hafas-record-delays
– Record delays fromhafas-monitor-departures
into a LevelDB.record-vbb-delays
– Record VBB departures from HAFAS.hafas-monitor-trips
– Using a HAFAS endpoint, watch all trips in a bounding box.hafas-monitor-trips-server
– A server that manageshafas-monitor-trips
instances.hafas-client
– JavaScript client for HAFAS public transport APIs.
Contributing
If you have a question, found a bug or want to propose a feature, have a look at the issues page.