azawawi / farabi6

Experimental in-browser Perl 6 Editor
Artistic License 2.0
14 stars 12 forks source link

[Run, REPL] if we have async I/O available, use it #42

Open timo opened 9 years ago

timo commented 9 years ago

this is interesting for the repl and execution in general:

if you have long-running code or even an infinitely looping piece of code, the web server farabi6 uses mustn't hang waiting for stuff to finish. Also,the user should be able to kill a run-away process from the web interface as well.

On MoarVM, Proc::Async would be a good choice to connect to a repl (not only because of killability) and distributing updates (status, output, ...) via EventSource would be a pretty neat thing to do

timo commented 9 years ago

sadly, EventSource isn't available on IE:

http://caniuse.com/#feat=eventsource

However, in that case, a fallback using regular ajax polling may be feasible.

azawawi commented 9 years ago

Experimented with EventSource and it works perfectly but we have the I/O blocking problem of HTTP::Easy::PSGI.

EventSource script needs to stay in a while 1 { } loop in order to serve browsers efficiently. Also for cross-browser support, we can utilize jquery.eventsource

Right now I am reading about https://github.com/rakudo/rakudo/blob/nom/src/core/IO/Socket/Async.pm

azawawi commented 9 years ago

Now that we a working step in with standard output and error stream, I think it is time to re-implement run functionality.