Finland, Helsinki - Real-time HSL transit map

A realtime transit map generated from the Helsinki transportation realtime MQTT stream, including rate limiting and WebSockets output.

[{"id":"3c3c3e7a.fbfaa2","type":"mqtt-broker","broker":"mqtt.hsl.fi","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"willQos":"0","birthQos":"0"},{"id":"aaa2e3f6.74bfb","type":"websocket-listener","path":"/ws/worldmap","wholemsg":"false"},{"id":"fe63be00.60748","type":"websocket out","z":"fe7f912d.ad35c","name":"HSL WebSocket Stream","server":"aaa2e3f6.74bfb","client":"","x":444.2547607421875,"y":290.611083984375,"wires":[]},{"id":"d51925cb.1eb44","type":"mqtt in","z":"fe7f912d.ad35c","name":"HSL open API","topic":"/hfp/journey/#","broker":"3c3c3e7a.fbfaa2","x":104,"y":52.646484375,"wires":[["75b2700.49e861"]]},{"id":"a6c15557.1a731","type":"function","z":"fe7f912d.ad35c","name":"Parse Vehicle","func":"var data = msg.payload;\n\nvar vehicle = {\n    name: data.VP.veh,\n    lat: data.VP.lat,\n    lon: data.VP.long,\n    icon: \"car\",\n    iconColor: \"red\",\n    extrainfo: data.VP.desi,\n    timeStamp: data.VP.tst\n};\n\nmsg.topic = vehicle.name;\nmsg.payload = vehicle;\n\nreturn msg;","outputs":1,"noerr":0,"x":280.25,"y":154.896484375,"wires":[["660b2c86.c9afdc","bdb8eab1.102b4"]]},{"id":"bdb8eab1.102b4","type":"debug","z":"fe7f912d.ad35c","name":"","active":true,"console":"false","complete":"false","x":442.5,"y":95,"wires":[]},{"id":"660b2c86.c9afdc","type":"delay","z":"fe7f912d.ad35c","name":"Rate limit","pauseType":"queue","timeout":"5","timeoutUnits":"seconds","rate":"12","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":376.5,"y":216,"wires":[["fe63be00.60748"]]},{"id":"75b2700.49e861","type":"json","z":"fe7f912d.ad35c","name":"","x":203.5,"y":102,"wires":[["a6c15557.1a731"]]}]
brylie

Flow Info

created 1 year ago

Node Types

Core
  • debug (x1)
  • delay (x1)
  • function (x1)
  • json (x1)
  • mqtt in (x1)
  • mqtt-broker (x1)
  • websocket out (x1)
  • websocket-listener (x1)

Tags

  • Transportation
  • Finland
  • helsinki
  • HSL
  • MQTT
  • Map
  • rate-limiting
  • proxy
  • real-time
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option