Sha256: bde4a10f06af22557738bdeee7e0b1dbbf4ee0506c2b28e470d88b6619d3a90e

Contents?: true

Size: 546 Bytes

Versions: 11

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module Isomorfeus
  module Transport
    class RackMiddleware
      WS_RESPONSE = [0, {}, []]

      def initialize(app)
        @app = app
      end

      def call(env)
        if env['PATH_INFO'] == Isomorfeus.api_websocket_path
          if env['rack.upgrade?'] == :websocket
            # TODO get session cookie
            env['rack.upgrade'] = Isomorfeus::Transport::ServerSocketProcessor.new
          end
          WS_RESPONSE
        else
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
isomorfeus-transport-1.0.0.zeta16 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta15 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta14 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta13 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta12 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta11 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta10 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta9 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta8 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta7 lib/isomorfeus/transport/rack_middleware.rb
isomorfeus-transport-1.0.0.zeta6 lib/isomorfeus/transport/rack_middleware.rb