I have wisper listeners in the app/listeners directory.
I also have the /config/initializers/wisper.rb
module Wisper
def self.setup
configure do |config|
config.broadcaster(:default, Broadcasters::LoggerBroadcaster.new(Rails.logger, Broadcasters::SendBroadcaster.new))
end
end
end
Wisper.setup
Wisper.subscribe(ProjectListener.new)
Wisper.subscribe(FeedListener.new)
Can I somehow force Rails to reload the Listeners at every request?
You could try wrapping the subscribes in a
to_prepareblock, something like:to_prepareis called once in production and before every request in development environment.If you subscribe in more than one initializer you could put the
Wisper.clearin an initializer named '01_clear_subscribers` to ensure the subscribers are only cleared once.Incidentally you don't need to override
setupto configure the broadcaster, just doWisper.configure do |config|.