Recently I had the idea to add a web server to a long running computation, which should give essentially updates on the status of the computation to all connected browsers by simply pushing the new data at rather large intervals.
Thinking about some number crunching style computation that runs a week on a cluster, and at certain milestones would want to push a status, or print intermediate critical warnings that the solver starts diverging etc., and with this enabling users to e.g. read/discuss them in a meeting even on a mobile…
Not being much of a web developer, I found HTML5 Server Sent Events (SSE) to perhaps be the feature to make this possible. An alternative could be WebSockets, as @hustf pointed out by commenting my current non-working solution using SSE in this gist.
I guess, the steps to be taken would be:
- create an http server that handles the basic connections (as in the gist above)
- create a logging function or IOStream for the computational kernel to “print” to,
- hook the two things somehow.
And the last two are pretty much where I’m stuck. I just don’t get it how to make that connection.
Google isn’t much help since only providing me with trivial examples…and not written in Julia either.
I’d be happy for any advice or hint towards some Julia code that is accomplishing something similar.
Edit: And I guess one of the issues is HttpServer.run(...)
blocking…