Sha256: 16eca8b7b5c871fc807811ed4af91447b7eedd8d1e016a360df7a7e92f7cdd86

Contents?: true

Size: 856 Bytes

Versions: 3

Compression:

Stored size: 856 Bytes

Contents

module Angelo

  class WebsocketResponder < Responder

    def params
      @params ||= parse_query_string
      @params
    end

    def request= request
      @params = nil
      @request = request
      @websocket = @request.websocket
      handle_request
    end

    def handle_request
      begin
        if @response_handler
          Angelo.log @connection, @request, @websocket, :switching_protocols
          @bound_response_handler ||= @response_handler.bind @base
          @bound_response_handler[@websocket]
        else
          raise NotImplementedError
        end
      rescue IOError => ioe
        warn "#{ioe.class} - #{ioe.message}"
        @websocket.close
        @base.websockets.delete @websocket
      rescue => e
        error e.message
        ::STDERR.puts e.backtrace
        @connection.close
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
angelo-0.1.2 lib/angelo/responder/websocket.rb
angelo-0.1.1 lib/angelo/responder/websocket.rb
angelo-0.1.0 lib/angelo/responder/websocket.rb