Sha256: 5bd6c53e4be5ff1f6458840a583064f74ab41680892ab332060b7400f4a5f76d

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 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
          @bound_response_handler ||= @response_handler.bind @base
          @bound_response_handler[@websocket]
        else
          raise NotImplementedError
        end
      rescue IOError => ioe
        error "#{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

1 entries across 1 versions & 1 rubygems

Version Path
angelo-0.0.4 lib/angelo/responder/websocket.rb