Sha256: 75b5a78d238d6af38a6a6731b1f6e126b4ffa04cd0518e80a63b58e09733645e

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

require 'async_cable/version'
require 'async_cable/errors'
require 'async_cable/config'
require 'async_cable/registry'
require 'async_cable/connection'
require 'async_cable/server'

module AsyncCable

  # @return [Async::Config]
  def config
    @config ||= Config.new
  end

  # @yield [Async::Config]
  def configure
    yield config
  end

  # Transmit data to all WS connections.
  # @param data [Hash]
  def broadcast(data)
    config.logger.debug { "#{name}.broadcast data=#{data.inspect}" }
    Registry.each { |conn| conn.transmit(data) }
  end

  module_function :configure, :config, :broadcast
  config # initialize config right away to prevent racing.
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
async_cable-0.2.2 lib/async_cable.rb
async_cable-0.2.1 lib/async_cable.rb