lib/async_cable/registry.rb in async_cable-0.1.0 vs lib/async_cable/registry.rb in async_cable-0.2.0
- old
+ new
@@ -44,9 +44,18 @@
return subscribers[channel_name].values.flatten if stream_name.nil?
subscribers[channel_name][stream_name]
end
end
+ # Iterate connections asynchronously.
+ # @param channel_name [String,NilClass]
+ # @param stream_name [String,NilClass]
+ # @yield connection [AsyncCable::Connection]
+ def each(channel_name = nil, stream_name = nil, &block)
+ list = find(channel_name, stream_name)
+ Util.each_async(list, &block)
+ end
+
private
def subscribers
@subscribers ||= new_subscribers
end