Turns the Deutsche Bahn ADAM API into an Event Emitter or a Server for Server Sent Events and Websocket Stream.
npm install liftstream.
Usage as Library
Liftstream emits an event every time the state of a lift changes.
var liftstream = ;var stream =statefile: "/tmp/statefile.json" // save elevator states hereinterval: "5m" // adam api polling intervaldev: false // send fake events for testing;stream;stream;
Usage as Server
First create your own
config.js.dist. Then you can start the server with
node server.js or
npm start. Please be reasonable with the
Every message consists of a single JSON encoded object.
Since the data changes very little, there is a developer mode, which returns a fake event on every update without other changes. It's activated by setting
true in config.js.
You can test your Server with
wscat --connect wss://server:port/stream.ws from the