So I have Blink.jl running electron locally, with widgets, plotting and simulation visuals etc. But I’d like to run it on a server. Apparently Blink facilitates using Mux to serve a simple app:
“Pages may be served over the internet…”
But it seems to be mostly undocumented? I see a file named server.jl, and other similar things… but how do I actually serve a single page app, exactly the same as my electron window?
I only recently started learning about this stuff so maybe this is a really dumb answer, but are you looking for https://github.com/JuliaGizmos/WebIO.jl#getting-things-to-display, i.e.
using WebIO, Mux
function myapp(req) # an "App" takes a request, returns the output
Node(:div, "Hello, World!")
webio_serve(page("/", req -> myapp(req))) # seved at localhost:8000
No that looks like a good answer!
I only just started yesterday, and hadn’t actually read the webIO readme yet. It seems like the best resource available! None of these packages have docs pages, and the modular structure makes it pretty hard find things. It really needs some love at some stage…
I’m curious, how’s Mux working for your use case? I’ve being trying it on a server but I found that on a multipage website Interact widgets quickly became nonresponsive (I suspect it’s an issue with WebSockets integration, but can’t tell for sure).
I’m trying to gather all the docs at Interact, as otherwise it’s very hard to follow things, see here. To be honest, given that Interact is a metapackage, it’d probably make sense to add Mux there as well as the relative documentation, but I would wait for Julia 0.7 for that (to avoid the binary HTTPServer / HTTPParser dependencies).
Feel free to make a doc PR to Interact to add the WebIO documentation, It’d be very helpful! WebIO is already reexported from Interact: as you mentioned, we do need a place where users can find all the info.
I should also add some Knockout.jl documentation there, though I was afraid too many things would confuse users, maybe we could open an issue at Interact to discuss docs.
I’m only using a single page website with Mux and it’s been ok so far, although after leaving it for a day the interface is taking a while to load and it feels slightly less responsive, but it is just a script run manually from vim/tmux, so I can’t really complain:
Edit: the controls do eventually show up! I was initially pretty much instant so not sure what is causing that delay.
(Interestingly it works great on chrome but updating images with observables flickers like crazy on Firefox)
The WebIO documentation is actually pretty good, although it could be a docs page. But when I was trying to set up a server by just looking at the Blink.jl and Mux.jl readme I was pretty lost. The downside of modularity is fragmentation of documentation…
I think you’re right that some core packages, like WebIO.jl and Interact.jl could take a central role n documentation, and the others could specifically link to them - neither Mux or Blink actually mention WebIO on their readme.