Sha256: a89d50bb90e6e1502514b828f5d919b8c306e35a7aa2b4f439dd579113d2e0d9

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

require 'rubrowser/channel'

module Rubrowser
  class Connection < LiteCable::Connection::Base
    identified_by :id

    def connect
      @id = rand(100_000)
      self.class.initiate_reader
    end

    def self.initiate_reader
      @initiate_reader ||= Thread.new do
        $rd.each_line do |line|
          LiteCable.broadcast('classes', message: line.strip)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubrowser-2.11 lib/rubrowser/connection.rb