Live Energy Pipeline
These are real readings from an electricity meter in Galicia. The meter sends a new reading every few seconds. On this page you can watch each reading go through the backend, see how long every step takes, and see where it ends up on the chart.
Each new reading lights up the stages in order. The times are measured on the server for the last reading.
- Step 1Shelly Pro EMElectricity metersends status
- Step 2MosquittoMQTT brokerTLS, port 8883
- Step 3Go serviceReads and parses the JSON---
- Step 4TimescaleDBInserts one row---
- Step 5RedisKeeps the latest value---
- Step 6SSEPushes to open pages---
- Step 7Your browserThis pagechart and log
Newest first. One line is one reading and the time of every step it went through.
Connecting to the live stream...
How it works
A Shelly Pro EM meter publishes its status over MQTT with TLS to a Mosquitto broker on my server. A Go service subscribes to the meter topics, parses the JSON and writes one row per reading into TimescaleDB, a time-series extension for PostgreSQL.
The latest value for each channel also goes to Redis, so the current-value API does not have to query the database. After that, the reading is pushed with Server-Sent Events to every open page, including this one.
There is no queue between MQTT and the database. One reading is one insert, and it takes a few milliseconds. All times on this page are measured on the server for every reading. They do not include the network time between the server and your browser.