Module: HasHelpers::WebSocketPublisher

Defined in:
lib/has_helpers/web_socket_publisher.rb

Class Method Summary collapse

Class Method Details

.publish(channel, _payload) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/has_helpers/web_socket_publisher.rb', line 5

def self.publish(channel, _payload)
  Rails.logger.warn <<~LOG.strip
    [HasHelpers::WebSocketPublisher] Attempted to publish to Redis (#{channel}) but no publisher is configured.
    Please define `HasHelpers::WebSocketPublisher` in an initializer (e.g., config/initializers/web_socket_publisher.rb)
    Example:
      module HasHelpers
        module WebSocketPublisher
          def self.publish(channel, payload)
            REDIS.publish(channel, payload.to_json)
          end
        end
      end
  LOG
end