Class: WampRails::Command::Subscribe
- Inherits:
-
BaseHandler
- Object
- BaseCommand
- BaseHandler
- WampRails::Command::Subscribe
- Defined in:
- lib/wamp_rails/commands/subscribe.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#options ⇒ Object
Returns the value of attribute options.
-
#topic ⇒ Object
Returns the value of attribute topic.
Attributes inherited from BaseCommand
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(topic, klass, options, client) ⇒ Subscribe
constructor
A new instance of Subscribe.
Methods inherited from BaseHandler
Methods inherited from BaseCommand
Constructor Details
#initialize(topic, klass, options, client) ⇒ Subscribe
Returns a new instance of Subscribe.
6 7 8 9 10 11 12 13 14 |
# File 'lib/wamp_rails/commands/subscribe.rb', line 6 def initialize(topic, klass, , client) super(client, klass) self.topic = topic self. = unless self.klass < WampRails::Controller::Subscription raise WampRails::Error.new('klass must be a WampRails::Controller::Subscription class') end end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/wamp_rails/commands/subscribe.rb', line 4 def klass @klass end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/wamp_rails/commands/subscribe.rb', line 4 def @options end |
#topic ⇒ Object
Returns the value of attribute topic.
4 5 6 |
# File 'lib/wamp_rails/commands/subscribe.rb', line 4 def topic @topic end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 |
# File 'lib/wamp_rails/commands/subscribe.rb', line 16 def execute session.subscribe(topic, handler, ) do |result, error, details| self.callback(result, error, details) end end |