I am currently creating a real time online web console that takes output from Bash and displays it on a PHP driven, HTML page. At the current moment, I'm using the method of fetching the entire contents of a page and replacing a DIV's contents with the contents of the fetched page, which is very inefficient, and am wondering how to do this more efficiently, such as with WebSockets, Faye, or long polling.
What is the fastest way I can get Bash output to a client? If you think I should use something that requires a server-side install, why?
WebSockets will give you significantly lower latency than AJAX/long-polling requests if that is important for your project.
There is a telnet example included with websockify (Disclaimer: I made websockify). Websockify bridges between websockets and TCP sockets. You might be able to use some ideas from that. In particular, you may want to look at the Javascript terminal emulator code that is included with that example if you want to implement anything more than just display of raw text.