def anonymous_websocket_route_factory(execute_cmd, base_dispatcher):
async def on_connection(request):
ws = web.WebSocketResponse()
await ws.prepare(request)
context = WebsocketClientConnectionContext(ws)
client_dispatcher = client_dispatcher_factory(context)
dispatcher = ComposedDispatcher([base_dispatcher, client_dispatcher])
context.logger.info('Connection started (anonymous connection)')
await _on_connection_main_loop(execute_cmd, context, dispatcher)
return ws
return on_connection
评论列表
文章目录