Sha256: 6c1c32489ea5298bb78474a712d45c8580f85d169666a58c29082c6a0d5b7ad1

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

require_relative "registered"

module Wamp
  module Manager
    module Event
      # Register Message Event
      class Register < Base
        def add_event_listener(handler, &block)
          session.transmit(payload)
          session.on(listen_event_name) do |registered, error|
            session.off(listen_event_name)
            block&.call(registered, error)

            unless error
              manager = Registered.new(registered, session)
              manager.add_event_listener(handler)
            end
          end
        end

        def emit_event(message)
          msg = Wamp::Router::Registrations.register(message, session)
          session.transmit(msg.payload)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xconn-0.1.2 lib/wamp/manager/event/register.rb
xconn-0.1.1 lib/wamp/manager/event/register.rb
xconn-0.1.0 lib/wamp/manager/event/register.rb