During development, I was planning to allow the server to push messages like a successful measurement start, stop, status messages,... to the management UI and then to connected web browsers.
The cli.py script already supports this.
Data transmission would happen via server side events using https://flask-sse.readthedocs.io/en/latest/quickstart.html or https://maxhalford.github.io/blog/flask-sse-no-deps/ then the web browser would display a Bootstrap toast if a new message is incoming. The benefit is that a user would directly get messaged if a device changes status.
Unfortunately, during this time I did not know about monkey patching, meaning the server would hang as soon as one web browser tries to retrieve new messages from the (no longer implemented) getStatusMessages endpoint. Now this issue is fixed, and server side events could be implemented.
There even was an implementation attempt I reverted (check git history around Jun 04,2024 in the private repo if you have access).
In general, only having access to the messages sounds like not being that important.
However, allowing SSE in the Management UI is a worthy change and would potentially allow the project to benefit significantly from more interactivity since the server can now directly forward commands to end users:
Status updates on the main page could be updated automatically without needing to resort on polling (alternative implementation). This gives an up to date view of the current measurement status
Errors could be passed from the Autopower device to the server and then via the Management UI directly to the web browser of the connected user
The server could notify send a real "measurement started/stopped successfully" message to the web browser clients.
Even if stopping a measurement due to long lasting data upload takes > 30s (the timeout after which the request to a client is seen as unsuccessful) the Management UI would not just show a timeout error. It would now be able to notify the user later that the measurement did indeed stop successfully despite the timeout.
Implementation may have some hurdles, is not per se trivial but doable.
During development, I was planning to allow the server to push messages like a successful measurement start, stop, status messages,... to the management UI and then to connected web browsers. The cli.py script already supports this.
Data transmission would happen via server side events using https://flask-sse.readthedocs.io/en/latest/quickstart.html or https://maxhalford.github.io/blog/flask-sse-no-deps/ then the web browser would display a Bootstrap toast if a new message is incoming. The benefit is that a user would directly get messaged if a device changes status. Unfortunately, during this time I did not know about monkey patching, meaning the server would hang as soon as one web browser tries to retrieve new messages from the (no longer implemented)
getStatusMessages
endpoint. Now this issue is fixed, and server side events could be implemented.https://github.com/nsg-ethz/autopower/blob/cdb4c9212433088ddd614a17a9a198c33e689427/server/server.py#L555 shows the gRPC method used to retrieve messages from the server.
There even was an implementation attempt I reverted (check git history around Jun 04,2024 in the private repo if you have access).
In general, only having access to the messages sounds like not being that important.
However, allowing SSE in the Management UI is a worthy change and would potentially allow the project to benefit significantly from more interactivity since the server can now directly forward commands to end users:
Implementation may have some hurdles, is not per se trivial but doable.