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

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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.