Class: Rocket::Server::Channel

Inherits:
EM::Channel
  • Object
show all
Defined in:
lib/rocket/server/channel.rb

Class Method Summary collapse

Class Method Details

.[](id) ⇒ Object

Get specfied channel for given app or create it if doesn’t exist.

Channel["my-app" => "testing-channel"] # => #<Rocket::Channel>
Channel["my-another-app" => "next-one"]


10
11
12
13
# File 'lib/rocket/server/channel.rb', line 10

def self.[](id)
  app, name = id.to_a.flatten
  channels[[app, name]] ||= new
end

.channelsObject

Returns list of registered channels.



16
17
18
# File 'lib/rocket/server/channel.rb', line 16

def self.channels
  @channels ||= {}
end