Module: Faye

Defined in:
lib/faye.rb,
lib/faye/error.rb,
lib/faye/mixins/logging.rb,
lib/faye/util/namespace.rb,
lib/faye/mixins/timeouts.rb,
lib/faye/protocol/client.rb,
lib/faye/protocol/server.rb,
lib/faye/util/web_socket.rb,
lib/faye/mixins/publisher.rb,
lib/faye/protocol/channel.rb,
lib/faye/protocol/grammar.rb,
lib/faye/network/transport.rb,
lib/faye/protocol/connection.rb,
lib/faye/protocol/extensible.rb,
lib/faye/adapters/rack_adapter.rb,
lib/faye/protocol/subscription.rb

Defined Under Namespace

Modules: Extensible, Grammar, Logging, Publisher, Timeouts Classes: Channel, Client, Connection, Error, HttpTransport, LocalTransport, Namespace, RackAdapter, Server, Subscription, Transport, WebSocket

Constant Summary collapse

VERSION =
'0.5.4'
ROOT =
File.expand_path(File.dirname(__FILE__))
BAYEUX_VERSION =
'1.0'
ID_LENGTH =
128
JSONP_CALLBACK =
'jsonpcallback'
CONNECTION_TYPES =
%w[long-polling callback-polling websocket]
MANDATORY_CONNECTION_TYPES =
%w[long-polling callback-polling in-process]

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/faye/mixins/logging.rb', line 4

def logger
  @logger
end

Class Method Details

.ensure_reactor_running!Object



52
53
54
55
# File 'lib/faye.rb', line 52

def self.ensure_reactor_running!
  Thread.new { EM.run } unless EM.reactor_running?
  while not EM.reactor_running?; end
end

.random(bitlength = ID_LENGTH) ⇒ Object



40
41
42
# File 'lib/faye.rb', line 40

def self.random(bitlength = ID_LENGTH)
  rand(2 ** bitlength).to_s(36)
end

.to_json(value) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/faye.rb', line 44

def self.to_json(value)
  case value
    when Hash, Array then JSON.unparse(value)
    when String, NilClass then value.inspect
    else value.to_s
  end
end