Class: Faye::RackStream
- Inherits:
-
Object
- Object
- Faye::RackStream
- Defined in:
- lib/padrino-websockets/faye/puma-patch.rb
Instance Method Summary collapse
-
#initialize(socket_object) ⇒ RackStream
constructor
A new instance of RackStream.
Constructor Details
#initialize(socket_object) ⇒ RackStream
Returns a new instance of RackStream.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/padrino-websockets/faye/puma-patch.rb', line 3 def initialize(socket_object) @socket_object = socket_object @connection = socket_object.env['em.connection'] @stream_send = socket_object.env['stream.send'] if socket_object.env['rack.hijack'] socket_object.env['rack.hijack'].call # # FIXME For some reason `rack.hijack_io` isn't set in `Padrino` when using it with `Puma`. # In the meantime, if you're using this, you can get away with `puma.socket` # @rack_hijack_io = socket_object.env['rack.hijack_io'] || socket_object.env['puma.socket'] EventMachine.attach(@rack_hijack_io, Reader) do |reader| @rack_hijack_io_reader = reader reader.stream = self end end @connection.socket_stream = self if @connection.respond_to?(:socket_stream) end |