MCPcopy
hub / github.com/encode/starlette / accept

Method accept

starlette/websockets.py:100–110  ·  view source on GitHub ↗
(
        self,
        subprotocol: str | None = None,
        headers: Iterable[tuple[bytes, bytes]] | None = None,
    )

Source from the content-addressed store, hash-verified

98 raise RuntimeError('Cannot call "send" once a close message has been sent.')
99
100 async def accept(
101 self,
102 subprotocol: str | None = None,
103 headers: Iterable[tuple[bytes, bytes]] | None = None,
104 ) -> None:
105 headers = headers or []
106
107 if self.client_state == WebSocketState.CONNECTING: # pragma: no branch
108 # If we haven't yet seen the 'connect' message, then wait for it first.
109 await self.receive()
110 await self.send({"type": "websocket.accept", "subprotocol": subprotocol, "headers": headers})
111
112 def _raise_on_disconnect(self, message: Message) -> None:
113 if message["type"] == "websocket.disconnect":

Callers 15

appFunction · 0.95
asgiFunction · 0.95
appFunction · 0.95
__call__Method · 0.95
on_connectMethod · 0.80
websocket_endpointFunction · 0.80
websocket_raise_customFunction · 0.80
websocket_stateFunction · 0.80
on_connectMethod · 0.80
websocket_endpointFunction · 0.80

Calls 2

receiveMethod · 0.95
sendMethod · 0.95

Tested by 15

appFunction · 0.76
asgiFunction · 0.76
appFunction · 0.76
__call__Method · 0.76
websocket_endpointFunction · 0.64
websocket_raise_customFunction · 0.64
websocket_stateFunction · 0.64
on_connectMethod · 0.64
websocket_endpointFunction · 0.64
partial_ws_endpointFunction · 0.64