zach-capalbo/flammarion

[Documentation] How does it work?

Opened this issue · 1 comments

Right now I don't quite understand how flammarion works.

If you ever have time and motivation, could you perhaps provide
one or two paragraphs about how flammarion achieves this
live communication with a browser? I mean that is pretty
nifty - I wonder if we can use that for bidirectionaly talking.

Thanks for the interest. I'll add something like this to documentation:

Flammarion works by launching a small web server and websocket server. The server serves some small pre-created HTML and JavaScript. Flammarion attempts to launch a browser in some kind of "app mode" to connect to the web server, which will then connect to the WebSocket server, which Flammarion uses to push UI changes to the browser, and send UI interactions back to Ruby.

Is this a helpful overview? Any points you'd like to know more about in particular? Bi-directional communication (via websockets) is already how input elements / gets functionality work, so you can do things like:

require 'flammarion'
f = Flammarion::Engraving.new
f.puts "Enter some text"
entered_text = f.gets

f.button("Click on #{entered_text}") do
  f.puts "You entered #{entered_text}"
end