Pass in a HAFAS client, fetch all departures at any set of stations. (You may get blacklisted.)
npm install hafas-monitor-departures
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 hafas =const departures =
createMonitor will call
hafas.departures() and writes each of the returned departures into the stream. It expects
departures() to be compatible with the implementation from
Note: A stream created by calling
createMonitor(…) does not stop calling the API if you
unpipe it. You need to manually call
To manually issue a single departures check at a station, use
departures.manual(id). The result will be emitted in a data event like all others.
hafas-record-delays– Record delays from
hafas-monitor-departuresinto a LevelDB.
record-vbb-delays– Record VBB departures from HAFAS.
If you have a question, found a bug or want to propose a feature, have a look at the issues page.