Class: Wamp::MessageHandler::Subscribed

Inherits:
Base
  • Object
show all
Defined in:
lib/wamp/message_handler/subscribed.rb

Overview

Receive subscribed

Instance Attribute Summary

Attributes inherited from Base

#connection, #message

Instance Method Summary collapse

Methods inherited from Base

#initialize, #send_message

Constructor Details

This class inherits a constructor from Wamp::MessageHandler::Base

Instance Method Details

#alt_store_keyObject



20
21
22
# File 'lib/wamp/message_handler/subscribed.rb', line 20

def alt_store_key
  "subscription_#{message.subscription_id}"
end

#handleObject



7
8
9
10
11
12
13
14
# File 'lib/wamp/message_handler/subscribed.rb', line 7

def handle
  validate_received_message

  store[alt_store_key] = { handler: stored_data.fetch(:handler), topic: stored_data.fetch(:topic) }
  store_topic

  deliver_response(response)
end

#responseObject



16
17
18
# File 'lib/wamp/message_handler/subscribed.rb', line 16

def response
  Type::Subscription.new(subscription_id: message.subscription_id)
end

#store_topicObject



24
25
26
27
# File 'lib/wamp/message_handler/subscribed.rb', line 24

def store_topic
  topic = stored_data.fetch(:topic)
  store[topic] = message.subscription_id
end