Sha256: 58e38df3ac8c6361afc9120fd4a3678d403c8d5e619f48ce49a100d6ff5ffcb0

Contents?: true

Size: 597 Bytes

Versions: 20

Compression:

Stored size: 597 Bytes

Contents

module Loco
  class Sender
    def initialize recipient, data = {}
      @recipients = [*recipient]
      @data = data
    end

    def emit
      uuids.each do |uuid|
        NotificationCenterChannel.broadcast_to uuid, @data
      end
    end

    private

      def uuids
        @recipients.map do |r|
          if r.is_a? String
            r
          elsif r.is_a? Hub
            r.raw_members.map{ |m| WsConnectionManager.new(m).connected_uuids }.flatten.uniq
          else
            WsConnectionManager.new(r).connected_uuids
          end
        end.flatten.uniq
      end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
loco-rails-2.5.3 lib/loco/sender.rb
loco-rails-2.5.2 lib/loco/sender.rb
loco-rails-2.5.1 lib/loco/sender.rb
loco-rails-2.5.0 lib/loco/sender.rb
loco-rails-2.4.0 lib/loco/sender.rb
loco-rails-2.3.0 lib/loco/sender.rb
loco-rails-3.0.0 lib/loco/sender.rb
loco-rails-2.2.2 lib/loco/sender.rb
loco-rails-2.2.1 lib/loco/sender.rb
loco-rails-2.2.0 lib/loco/sender.rb
loco-rails-2.1.0 lib/loco/sender.rb
loco-rails-2.0.0 lib/loco/sender.rb
loco-rails-1.5.2 lib/loco/sender.rb
loco-rails-1.5.1 lib/loco/sender.rb
loco-rails-1.5.0 lib/loco/sender.rb
loco-rails-1.4.0 lib/loco/sender.rb
loco-rails-1.3.3 lib/loco/sender.rb
loco-rails-1.3.2 lib/loco/sender.rb
loco-rails-1.3.1 lib/loco/sender.rb
loco-rails-1.3.0 lib/loco/sender.rb