Sha256: 2fbf7de708ca40196eca994e0ee9d963ff72fd3ff63dfc5c57fc126edbac6718

Contents?: true

Size: 779 Bytes

Versions: 2

Compression:

Stored size: 779 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
        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

2 entries across 2 versions & 1 rubygems

Version Path
angelo-0.0.9 lib/angelo/responder/websocket.rb
angelo-0.0.7 lib/angelo/responder/websocket.rb