Sha256: d9422a72884a444e683c3ee4c212fdbd73d111ddfeca82efe14faf2246bdb8b6

Contents?: true

Size: 774 Bytes

Versions: 3

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

require "delegate"

module Wamp
  module Manager
    # no:doc
    module Event
      # Base Class for Listening and Emitting events
      # Each event should base as parent class
      class Base < SimpleDelegator
        attr_reader :session

        def initialize(message, session)
          super(message)
          @session = session
        end

        def emit_event(message)
          session.emit(emit_event_name, message)
        end

        def transmit
          session.transmit(payload)
        end

        def listen_event_name
          "request_#{request_id}"
        end

        def emit_event_name
          "request_#{request_id}"
        end

        def error?
          false
        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/base.rb
xconn-0.1.1 lib/wamp/manager/event/base.rb
xconn-0.1.0 lib/wamp/manager/event/base.rb