def handle_one_response(self):
path = self.environ.get('<STR_LIT>')<EOL>if not path.lstrip('<STR_LIT:/>').startswith(self.server.resource + '<STR_LIT:/>'):<EOL><INDENT>return super(SocketIOHandler, self).handle_one_response()<EOL><DEDENT>self.status = None<EOL>self.headers_sent = False<EOL>self.result = None<EOL>self.response_length = <NUM_LIT:0><EOL>self.response_use_chunked = False<EOL>request_method = self.environ.get("<STR_LIT>")<EOL>request_tokens = self.RE_REQUEST_URL.match(path)<EOL>handshake_tokens = self.RE_HANDSHAKE_URL.match(path)<EOL>disconnect_tokens = self.RE_DISCONNECT_URL.match(path)<EOL>if handshake_tokens:<EOL><INDENT>return self._do_handshake(handshake_tokens.groupdict())<EOL><DEDENT>elif disconnect_tokens:<EOL><INDENT>tokens = disconnect_tokens.groupdict()<EOL><DEDENT>elif request_tokens:<EOL><INDENT>tokens = request_tokens.groupdict()<EOL><DEDENT>else:<EOL><INDENT>return super(SocketIOHandler, self).handle_one_response()<EOL><DEDENT>sessid = tokens["<STR_LIT>"]<EOL>socket = self.server.get_socket(sessid)<EOL>if not socket:<EOL><INDENT>self.handle_bad_request()<EOL>return []  <EOL><DEDENT>if self.environ['<STR_LIT>'].startswith('<STR_LIT>'):<EOL><INDENT>socket.disconnect()<EOL>self.handle_disconnect_request()<EOL>return []<EOL><DEDENT>transport = self.handler_types.get(tokens["<STR_LIT>"])<EOL>old_class = None<EOL>if issubclass(transport, (transports.WebsocketTransport,<EOL>transports.FlashSocketTransport)):<EOL><INDENT>old_class = self.__class__<EOL>self.__class__ = self.server.ws_handler_class<EOL>self.prevent_wsgi_call = True  <EOL>self.handle_one_response()  <EOL><DEDENT>self.environ['<STR_LIT>'] = socket<EOL>self.transport = transport(self, self.config)<EOL>self.transport.do_exchange(socket, request_method)<EOL>if not socket.connection_established:<EOL><INDENT>socket.connection_established = True<EOL>socket.state = socket.STATE_CONNECTED<EOL>socket._spawn_heartbeat()<EOL>socket._spawn_watcher()<EOL>try:<EOL><INDENT>if socket.wsgi_app_greenlet is None:<EOL><INDENT>start_response = lambda status, headers, exc=None: None<EOL>socket.wsgi_app_greenlet = gevent.spawn(self.application,<EOL>self.environ,<EOL>start_response)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>self.handle_error(*sys.exc_info())<EOL><DEDENT><DEDENT>if tokens['<STR_LIT>'] in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>gevent.joinall(socket.jobs)<EOL><DEDENT>if old_class:<EOL><INDENT>self.__class__ = old_class<EOL><DEDENT>if hasattr(self, '<STR_LIT>') and self.websocket:<EOL><INDENT>if hasattr(self.websocket, '<STR_LIT>'):<EOL><INDENT>del self.websocket.environ<EOL><DEDENT>del self.websocket<EOL><DEDENT>if self.environ:<EOL><INDENT>del self.environ<EOL><DEDENT>
This function deals with *ONE INCOMING REQUEST* from the web.

        It will wire and exchange message to the queues for long-polling
        methods, otherwise, will stay alive for websockets.