MCPcopy Index your code
hub / github.com/microsoft/playwright-python / handle_ws

Function handle_ws

tests/sync/test_route_web_socket.py:349–355  ·  view source on GitHub ↗
(ws: WebSocketRoute)

Source from the content-addressed store, hash-verified

347 log: list[str] = []
348
349 async def handle_ws(ws: WebSocketRoute) -> None:
350 def on_message(message: Union[str, bytes]) -> None:
351 assert isinstance(message, str)
352 log.append(message)
353 ws.send("response")
354
355 ws.on_message(on_message)
356
357 # No trailing slash in the route pattern
358 page.route_web_socket(f"ws://localhost:{server.PORT}", handle_ws)

Callers

nothing calls this directly

Calls 1

on_messageMethod · 0.45

Tested by

no test coverage detected