MCPcopy
hub / github.com/benoitc/gunicorn / _handle_websocket

Method _handle_websocket

gunicorn/asgi/protocol.py:913–928  ·  view source on GitHub ↗

Handle WebSocket upgrade request.

(self, request, sockname, peername)

Source from the content-addressed store, hash-verified

911 return upgrade == "websocket" and connection and "upgrade" in connection
912
913 async def _handle_websocket(self, request, sockname, peername):
914 """Handle WebSocket upgrade request."""
915 from gunicorn.asgi.websocket import WebSocketProtocol
916
917 # Stop callback parser - WebSocket uses its own data handling
918 self._callback_parser = None
919
920 scope = self._build_websocket_scope(request, sockname, peername)
921 ws_protocol = WebSocketProtocol(
922 self.transport, scope, self.app, self.log
923 )
924
925 # Store reference so data_received() forwards to WebSocket
926 self._websocket = ws_protocol
927
928 await ws_protocol.run()
929
930 async def _handle_http_request(self, request, sockname, peername):
931 """Handle a single HTTP request."""

Callers 2

_handle_connectionMethod · 0.95

Calls 3

runMethod · 0.95
WebSocketProtocolClass · 0.90

Tested by

no test coverage detected