Reputation: 39
I am trying to run a command on a UNIX console and display its STDOUT on a webpage in realtime with Ruby on Rails. Currently, I can use the following approaches to run the system commands:
However, I am unable to figure out the real-time aspects with Rails 3.0. Would I have poll a url with Javascript? I would be very grateful if someone could give a simple example to work off from.
Thanks so much and please let me know if you need more information on my question.
Upvotes: 0
Views: 722
Reputation: 23047
You can use one of available libraries for WebSockets communication, check out this link with some highlighted libraries: Best Ruby on Rails WebSocket tool
And on client side, you need simple JavaScript WebSockets application, and you can output the messages as text, into textfield using DOM function to append text. Or even create DIV elements for each message and append them in beginning of another container DIV element.
Upvotes: 1
Reputation: 6408
You can either poll with Javascript or push with websockets.
Upvotes: 2