Class: Rocket::Channel
- Inherits:
-
Object
- Object
- Rocket::Channel
- Defined in:
- lib/rocket/channel.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client, channel) ⇒ Channel
constructor
A new instance of Channel.
- #trigger(event, data) ⇒ Object
Constructor Details
#initialize(client, channel) ⇒ Channel
Returns a new instance of Channel.
9 10 11 12 |
# File 'lib/rocket/channel.rb', line 9 def initialize(client, channel) @client = client @channel = channel end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
7 8 9 |
# File 'lib/rocket/channel.rb', line 7 def channel @channel end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/rocket/channel.rb', line 6 def client @client end |
Instance Method Details
#trigger(event, data) ⇒ Object
14 15 16 17 18 |
# File 'lib/rocket/channel.rb', line 14 def trigger(event, data) client.connection do |socket| socket.send({ :event => event, :channel => channel, :data => data }.to_json) end end |