class Faye::Transport

Public Instance Methods

batching?() click to toggle source
# File lib/faye/transport/transport.rb, line 24
def batching?
  true
end
close() click to toggle source
# File lib/faye/transport/transport.rb, line 28
def close
end
connection_type() click to toggle source
# File lib/faye/transport/transport.rb, line 35
def connection_type
  self.class.connection_type
end
encode(messages) click to toggle source
# File lib/faye/transport/transport.rb, line 31
def encode(messages)
  ''
end
send_message(message) click to toggle source
# File lib/faye/transport/transport.rb, line 39
def send_message(message)
  debug('Client ? sending message to ? via ?: ?', @dispatcher.client_id, @endpoint, connection_type, message)

  unless batching?
    promise = EventMachine::DefaultDeferrable.new
    promise.succeed(request([message]))
    return promise
  end

  @outbox << message
  flush_large_batch

  if message['channel'] == Channel::HANDSHAKE
    return publish(0.01)
  end

  if message['channel'] == Channel::CONNECT
    @connection_message = message
  end

  publish(Engine::MAX_DELAY)
end

Public Class Methods

new(dispatcher, endpoint) click to toggle source
# File lib/faye/transport/transport.rb, line 12
def initialize(dispatcher, endpoint)
  super()
  @dispatcher = dispatcher
  @endpoint   = endpoint
  @outbox     = []
  @proxy      = @dispatcher.proxy.dup

  @proxy[:origin] ||= @endpoint.respond_to?(:find_proxy) ?
                      @endpoint.find_proxy :
                      nil
end