[Catalyst] streaming output to view in real time
david.morel at amakuru.net
Tue Apr 10 17:13:04 GMT 2007
Le 10 avr. 07 à 17:57, Jimmy Cooksey a écrit :
> I'm looking for a way to redirect STDOUT from an external application
> directly into my website, updating in real time.
> My original plan is to do something like this:
> 1. Controller popen's some program
> 2. Reads the file descriptor
> 3. Redirects each new line into some DIV in my view, showing each new
> line in real time.
> This controller would be called after a form submit.
> #3 is the part I don't know how to do, or if it's even possible. I
> haven't seen a $c->res method that lets me update directly into a DIV,
> which I was kind of banking on. The "real time" part is pretty
> imperative also. I can't get away with waiting for the program to
> execute, then dumping all of it's output at once.
> Any general guidance is greatly appreciated.
You want ajax here. I designed stuff maintaining an HTTP connexion
open for hours, but it was not pretty.
I'd run the task using POE / IPC::Run or Expect and leaving the
server process alone. You'd then use Ajax to query the running process.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 155 bytes
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070410/332c780e/PGP.pgp
More information about the Catalyst