Sha256: 0550f24573d7a131fa62d0c30b5cb74d0e9b63bd074e210557d141986525761e

Contents?: true

Size: 396 Bytes

Versions: 2

Compression:

Stored size: 396 Bytes

Contents

require 'rubrowser/channel'

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubrowser-2.7.1 lib/rubrowser/connection.rb
rubrowser-2.7.0 lib/rubrowser/connection.rb