Sha256: 2d29a6f6f9bd5f0b4e638b922fd1cdfdebc3d8b7d5a7f46d957991c2939b9032

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module JPC
  class Handler
    attr_accessor :token

    def initialize(ws, dispatcher)
      @ws = ws
      @dispatcher = dispatcher
    end

    def ping(params = {})
      "pong #{params.inspect}"
    end

    def subscribe(channel)
      @dispatcher.subscribe(@ws, channel)
    end

    def unsubscribe(channel)
      @dispatcher.unsubscribe(@ws, channel)
    end

    private

    def allowed?(method)
      %w(ping subscribe unsubscribe).include?(method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jpc-1.3.0 lib/jpc/handler.rb