Add websocket route so that server can notify clients about job progress #15
Labels
FR enhancement
New feature or request regarding a functional reqirement
low priority
if we should have lots of time
Currently the frontend has to call the /api/jobs/info route periodically (every 15 seconds) for all jobs it wants to keep up-to-date. This has some problems:
Proposed solution: Add a new route (like /api/jobs/subscribe) that provides a websocket endpoint. When a client calls this route a websocket connection will be created between client and server and the server stores this connection in an array. When the server receives a progress update from a runner over the heartbeat, it will forward it to all connections in that array. This will effectively notify the clients of a progress change, there is no need anymore for the clients to periodically query the api.
The /api/jobs/info route should stay unaffected by this since it will be easier to use than a websocket and some clients (like e.g. bash or python scripts) will still prefer to use it.
The text was updated successfully, but these errors were encountered: