Stream READING?

8 views
Skip to first unread message

Сергей Жуматий

unread,
Aug 1, 2017, 3:49:16 AM8/1/17
to sinatrarb
  Hello!
  I need to read continuously large real-time data. I don't want to send each piece of data with single POST, I want to open a connection and read all events while they happened.
  How can I do this with Sinatra? It ried this:
post '/mystream' do
  stream
(:keep_open) do |input|
    input
.each_line do |line|
      warn
"Got: #{line}"
     
end
 
end
end

But it didn't work at all.
Reply all
Reply to author
Forward
0 new messages