Ruby on Rails Sunday, August 1, 2010

On Aug 1, 9:09 pm, Jatin Kumar <li...@ruby-forum.com> wrote:
> Frederick Cheung wrote:
> > On Aug 1, 7:29 pm, Jatin Kumar <li.
>
> >
>
> @Fred :-I have been looking over the internet for a solution but never
> got a real answer. Thanks for your help.
> My web app allows the user to run code in the browser window itself, so
> do i really need to do polling for that? I mean is there any better
> solution? If not, how can I use your approach. I have never tried
> something like that before, so a little confused. Can you explain it
> using a little code snippet? That would really help me out.

Don't have any code snippets, just one way I'd try tackling this - run
the commands from a separate ruby process and use whatever mechanism
you want (drb might be handy) to allow your controller action to get
from this process what the state of the command being run is.

> Also, the responses would be through AJAX. The user code will be sent
> back to server through an AJAX call, the file created for the code and
> then the response back to the browser(the output of file executed) in an
> AJAX call. So, that guarantee that next request will go to same rails
> instance, won't that vanish away or not? Could be elaborate a little bit
> on this too.

Unless I've misunderstood your command needs to keep running over the
course of several requests if you're going to be getting input from
the users at the point. Unless you're willing for your rails code to
just block until input is required ( not a great idea) you'll need
some form of polling/comet.

> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment