Class: Thin::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/faye/adapters/thin.rb

Overview

Copyright © 2009-2011 Pratik Naik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#socket_streamObject

Returns the value of attribute socket_stream.



27
28
29
# File 'lib/faye/adapters/thin.rb', line 27

def socket_stream
  @socket_stream
end

Instance Method Details

#processObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/faye/adapters/thin.rb', line 32

def process
  if @serving != :websocket and @request.websocket?
    @serving = :websocket
  end
  if @request.async_connection?
    @request.env['em.connection'] = self
    @response.persistent!
    @response.async = true
  end
  thin_process
end

#receive_data(data) ⇒ Object



44
45
46
47
# File 'lib/faye/adapters/thin.rb', line 44

def receive_data(data)
  return thin_receive_data(data) unless @serving == :websocket
  socket_stream.receive(data) if socket_stream
end

#thin_processObject



29
# File 'lib/faye/adapters/thin.rb', line 29

alias :thin_process      :process

#thin_receive_dataObject



30
# File 'lib/faye/adapters/thin.rb', line 30

alias :thin_receive_data :receive_data