Sha256: 73e17ca407a2e71a0541ac482f4e82c1b9c9cc925d6f1ee2620a1ae9d21f73f2

Contents?: true

Size: 576 Bytes

Versions: 28

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module AnyCable
  module BroadcastAdapters
    class Base
      def raw_broadcast(_data)
        raise NotImplementedError
      end

      def broadcast(stream, payload)
        raw_broadcast({stream: stream, data: payload}.to_json)
      end

      def broadcast_command(command, **payload)
        raw_broadcast({command: command, payload: payload}.to_json)
      end

      def announce!
        logger.info "Broadcasting via #{self.class.name}"
      end

      private

      def logger
        AnyCable.logger
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
anycable-core-1.4.2 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.0 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.0.rc.3 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.0.rc.2 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.0.rc.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.4.0.pre.rc.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.3.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.3.0 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.5 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.4 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.3 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.2 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.2.0 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.1.4 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.1.3 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.1.2 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.1.1 lib/anycable/broadcast_adapters/base.rb
anycable-core-1.1.0 lib/anycable/broadcast_adapters/base.rb