Module: Faye::Engine

Defined in:
lib/faye/engines/proxy.rb,
lib/faye/engines/memory.rb,
lib/faye/engines/connection.rb

Defined Under Namespace

Classes: Connection, Memory, Proxy

Constant Summary collapse

METHODS =
%w[create_client client_exists destroy_client ping subscribe unsubscribe]
MAX_DELAY =
0.0
INTERVAL =
0.0
TIMEOUT =
60.0
ID_LENGTH =
160

Class Method Summary collapse

Class Method Details

.ensure_reactor_running!Object



13
14
15
16
# File 'lib/faye/engines/proxy.rb', line 13

def self.ensure_reactor_running!
  Thread.new { EventMachine.run } unless EventMachine.reactor_running?
  Thread.pass until EventMachine.reactor_running?
end

.get(options) ⇒ Object



18
19
20
# File 'lib/faye/engines/proxy.rb', line 18

def self.get(options)
  Proxy.new(options)
end

.random(bitlength = ID_LENGTH) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/faye/engines/proxy.rb', line 22

def self.random(bitlength = ID_LENGTH)
  limit    = 2 ** bitlength
  max_size = (bitlength * Math.log(2) / Math.log(36)).ceil
  string   = SecureRandom.random_number(limit).to_s(36)
  string   = '0' + string while string.size < max_size
  string
end