Class: Nico::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/nico/room/listener.rb

Instance Method Summary collapse

Constructor Details

#initialize(id, token) ⇒ Listener

Returns a new instance of Listener.



10
11
12
# File 'lib/nico/room/listener.rb', line 10

def initialize(id, token)
  @url = "http://#{token}:[email protected]/room/#{id}/live.json"
end

Instance Method Details

#eachObject



14
15
16
17
18
# File 'lib/nico/room/listener.rb', line 14

def each
  Yajl::HttpStream.get(URI.parse @url) do |json|
    yield Message.new(json)
  end
end