Class: Wamp::Client::Message::Subscribe
- Defined in:
- lib/wamp/client/message.rb
Overview
Subscribe Subscribe request sent by a Subscriber to a Broker to subscribe to a topic. Formats:
[SUBSCRIBE, Request|id, Options|dict, Topic|uri]
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#request ⇒ Object
Returns the value of attribute request.
-
#topic ⇒ Object
Returns the value of attribute topic.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(request, options, topic) ⇒ Subscribe
constructor
A new instance of Subscribe.
- #payload ⇒ Object
- #to_s ⇒ Object
Methods included from Check
Constructor Details
#initialize(request, options, topic) ⇒ Subscribe
Returns a new instance of Subscribe.
415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/wamp/client/message.rb', line 415 def initialize(request, , topic) self.class.check_id('request', request) self.class.check_dict('options', ) self.class.check_uri('topic', topic) self.request = request self. = self.topic = topic end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
413 414 415 |
# File 'lib/wamp/client/message.rb', line 413 def @options end |
#request ⇒ Object
Returns the value of attribute request.
413 414 415 |
# File 'lib/wamp/client/message.rb', line 413 def request @request end |
#topic ⇒ Object
Returns the value of attribute topic.
413 414 415 |
# File 'lib/wamp/client/message.rb', line 413 def topic @topic end |
Class Method Details
.parse(params) ⇒ Object
431 432 433 434 435 436 437 438 439 |
# File 'lib/wamp/client/message.rb', line 431 def self.parse(params) self.check_gte('params list', 4, params.count) self.check_equal('message type', self.type, params[0]) params.shift self.new(*params) end |
Instance Method Details
#payload ⇒ Object
441 442 443 444 445 446 447 448 449 |
# File 'lib/wamp/client/message.rb', line 441 def payload payload = [self.class.type] payload.push(self.request) payload.push(self.) payload.push(self.topic) payload end |
#to_s ⇒ Object
451 452 453 |
# File 'lib/wamp/client/message.rb', line 451 def to_s 'SUBSCRIBE > ' + self.payload.to_s end |