Class: App::Helpers::SSE::Streamer

Inherits:
Object
  • Object
show all
Includes:
JSON
Defined in:
app/helpers/sse.rb

Instance Method Summary collapse

Methods included from JSON

#json_dump

Constructor Details

#initialize(out) ⇒ Streamer

Returns a new instance of Streamer.



9
10
11
# File 'app/helpers/sse.rb', line 9

def initialize(out)
  @out = out
end

Instance Method Details

#host_down(host) ⇒ Object



21
22
23
# File 'app/helpers/sse.rb', line 21

def host_down(host)
  @out << "event: host_down\ndata: #{json_dump(host)}\n\n"
end

#host_found(host) ⇒ Object



13
14
15
# File 'app/helpers/sse.rb', line 13

def host_found(host)
  @out << "event: host_found\ndata: #{json_dump(host)}\n\n"
end

#host_lost(host) ⇒ Object



25
26
27
# File 'app/helpers/sse.rb', line 25

def host_lost(host)
  @out << "event: host_lost\ndata: #{json_dump(host)}\n\n"
end

#host_up(host) ⇒ Object



17
18
19
# File 'app/helpers/sse.rb', line 17

def host_up(host)
  @out << "event: host_up\ndata: #{json_dump(host)}\n\n"
end

#keyspace_changed(keyspace) ⇒ Object



33
34
35
# File 'app/helpers/sse.rb', line 33

def keyspace_changed(keyspace)
  @out << "event: keyspace_changed\ndata: #{json_dump(keyspace)}\n\n"
end

#keyspace_created(keyspace) ⇒ Object



29
30
31
# File 'app/helpers/sse.rb', line 29

def keyspace_created(keyspace)
  @out << "event: keyspace_created\ndata: #{json_dump(keyspace)}\n\n"
end

#keyspace_dropped(keyspace) ⇒ Object



37
38
39
# File 'app/helpers/sse.rb', line 37

def keyspace_dropped(keyspace)
  @out << "event: keyspace_dropped\ndata: #{json_dump(keyspace)}\n\n"
end