Sha256: 270c428c3c2d8c4b211079a1b5f703ffb629b77a7d8a64adec199c842bd33b22

Contents?: true

Size: 672 Bytes

Versions: 3

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

module Wamp
  module MessageHandler
    # Receive subscribed
    class Subscribed < Base
      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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xconn-0.1.2 lib/wamp/message_handler/subscribed.rb
xconn-0.1.1 lib/wamp/message_handler/subscribed.rb
xconn-0.1.0 lib/wamp/message_handler/subscribed.rb