Class: Reel::EventStream

Inherits:
Stream
  • Object
show all
Defined in:
lib/reel/stream.rb

Instance Method Summary collapse

Methods inherited from Stream

#call, #close, #closed?, #each, #initialize, #write

Constructor Details

This class inherits a constructor from Reel::Stream

Instance Method Details

#data(data) ⇒ Object



55
56
57
58
59
60
# File 'lib/reel/stream.rb', line 55

def data(data)
  # - any single message should not contain \n except at the end.
  # - EventSource expects \n\n at the end of each single message.
  write "data: %s\n\n" % data.gsub(/\n|\r/, '')
  self
end