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 =
128

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 { EM.run } unless EM.reactor_running?
  Thread.pass until EM.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 - 1
  max_size = limit.to_s(36).size
  string   = rand(limit).to_s(36)
  string = '0' + string while string.size < max_size
  string
end