Sha256: 83de0a09588f24965f39e85114cfb691d063bdf7d1bbe4b7d04556d5ce78f3e0
Contents?: true
Size: 704 Bytes
Versions: 4
Compression:
Stored size: 704 Bytes
Contents
module Asynchronic module Notifier class Broadcaster def initialize(options={}) options[:logger] ||= Asynchronic.logger @broadcaster = ::Broadcaster.new options end def publish(pid, event, data=nil) broadcaster.publish DataStore::Key[pid][event], data end def subscribe(pid, event, &block) broadcaster.subscribe DataStore::Key[pid][event] do |data| block.call data end end def unsubscribe(subscription_id) broadcaster.unsubscribe subscription_id end def unsubscribe_all broadcaster.unsubscribe_all end private attr_reader :broadcaster end end end
Version data entries
4 entries across 4 versions & 1 rubygems