Sha256: fc155408f7ee2d91a63257fc46eeade2cb19373094e3dfd78ce00563c0ec5f2b
Contents?: true
Size: 745 Bytes
Versions: 10
Compression:
Stored size: 745 Bytes
Contents
# Listen for all events # See whether any ActionCable client is subscribed to them # and, if so, broadcast the event over ActionCable. Houston.observer.on :* do |event, params| event_channel = EventsChannel.name_of(event) channels = case ActionCable.server.pubsub.class.name when "ActionCable::SubscriptionAdapter::Async" ActionCable.server.pubsub.send(:subscriber_map).instance_variable_get(:@subscribers).keys when "ActionCable::SubscriptionAdapter::Redis" ActionCable.server.pubsub.redis_connection_for_subscriptions.pubsub("channels") end if channels.member? event_channel params = MultiJson.load(Houston::Serializer.new.dump(params)) ActionCable.server.broadcast(EventsChannel.name_of(event), params) end end
Version data entries
10 entries across 10 versions & 1 rubygems