Module: Faye

Defined in:
lib/faye.rb,
lib/faye/error.rb,
lib/faye/server.rb,
lib/faye/channel.rb,
lib/faye/grammar.rb,
lib/faye/connection.rb,
lib/faye/rack_adapter.rb

Defined Under Namespace

Modules: Grammar Classes: Channel, Connection, Error, RackAdapter, Server

Constant Summary collapse

VERSION =
'0.1.1'
ROOT =
File.expand_path(File.dirname(__FILE__))
CLIENT_SCRIPT =
File.join(ROOT, 'faye-min.js')
BAYEUX_VERSION =
'1.0'
ID_LENGTH =
128
JSONP_CALLBACK =
'jsonpcallback'
CONNECTION_TYPES =
%w[long-polling callback-polling]

Class Method Summary collapse

Class Method Details

.random(bitlength = ID_LENGTH) ⇒ Object



24
25
26
27
28
# File 'lib/faye.rb', line 24

def self.random(bitlength = ID_LENGTH)
  field  = 2 ** bitlength
  strlen = bitlength / 4
  ("%0#{strlen}s" % rand(field).to_s(16)).gsub(' ', '0')
end