firehoseio/firehose

View on GitHub
lib/firehose/server/message_filter.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module Firehose
  module Server
    # A no-op message filter. This class is meant to be
    # extended by users for implementing channel middleware.
    class MessageFilter
      attr_reader :channel, :params

      def initialize(channel)
        @channel = channel
        @params = {}
      end

      def process(message)
      end

      def on_subscribe(params)
        @params = params
      end

      def on_unsubscribe
        @params = {}
      end
    end
  end
end