Forum: Ruby on Rails sse.rb :|: Streaming console ansi applications.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D974b374bd09edcef9285ff7c4f59ea5?d=identicon&s=25 Bigmac Turdsplash (i8igmac)
on 2016-10-30 23:41
http://tenderlovemaking.com/2012/07/30/is-it-live.html
all my examples are built from this information... my streaming examples
are working...


new rails user and im working on my live streaming web app... things are
working well and this is exciting ;-)

i have 3 linux console applications i would like to stream.

`ping google.com`
`mtr localhost`
`wavemon wlan0`

so, the ping command will print one line at a time and this is easy to
build a function to send data down the pipes




(part of my action controle live SSE.rb)

Open3.popen3("ping google.com"){|i,output,t,p|
      while true
            sse.write(output.gets)
      end
}




so i simply read each line of the popen3() and sse.write(data) to the
webclient... my jquery will .empty().append() each line to the client
webbrowser...

so far all is well and this is a lot of fun!!! im in control of what
data and when to send the data down the pipe...





So, now mtr linux command will print ansi data... it seems like this
console application prints 3 lines wrapped in ansi, clears its buffer
and prints again 3 lines...

any ideas on how i can handle this data from mtr? looks like it ends in
\n so maybe read until newline operator is present?

and for wavemon im not sure how to handle this... but hopes that solving
the problem with mtr will lead to a new way to handle console
application io.
This topic is locked and can not be replied to.