This device dashboard is developed with modern and compact Preact framework,
in order to fit on a very small devices. This is
a hybrid server which
provides both static and dynamic content. Static files, like CSS/JS/HTML
or images, are compiled into the server binary. Dynamic content is
served via the REST API.
This dashboard shows values kept in server memory. Many clients can open
this page. The JS code that watches state changes, reconnects on network
failures. That means if server restarts, dashboard on all connected clients
refresh automatically.
NOTE: administrators can change settings values, whilst users cannot.
This UI uses the REST API implemented by the server, which you can examine
using curl command-line utility:
curl localhost:8000/api/config/get - get current device configuration
curl localhost:8000/api/config/set -d 'value1=7&value2=hello' - set device configuration
As soon as administrator updates configuration,
server iterates over all connected clients and sends update
notifications to all of them - so they update automatically.