Class: WampClient::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.
493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/wamp_client/message.rb', line 493 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.
491 492 493 |
# File 'lib/wamp_client/message.rb', line 491 def @options end |
#request ⇒ Object
Returns the value of attribute request.
491 492 493 |
# File 'lib/wamp_client/message.rb', line 491 def request @request end |
#topic ⇒ Object
Returns the value of attribute topic.
491 492 493 |
# File 'lib/wamp_client/message.rb', line 491 def topic @topic end |
Class Method Details
.parse(params) ⇒ Object
509 510 511 512 513 514 515 516 517 |
# File 'lib/wamp_client/message.rb', line 509 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
519 520 521 522 523 524 525 526 527 |
# File 'lib/wamp_client/message.rb', line 519 def payload payload = [self.class.type] payload.push(self.request) payload.push(self.) payload.push(self.topic) payload end |
#to_s ⇒ Object
529 530 531 |
# File 'lib/wamp_client/message.rb', line 529 def to_s 'SUBSCRIBE > ' + self.payload.to_s end |