Python websockets recv

Не очень понимаю как решить данную проблему

    async def connect_to_simpledevice(admin_websocket: WebSocketServerProtocol,
                              controller_websocket: 
 WebSocketServerProtocol):
    """
    CONNECTING, OPEN, CLOSING, CLOSED
    """

    print(f'\nSimpleDevice connection'
          f'\nAdmin websocket state: {admin_websocket.state}'
          f'\nController websocket state{controller_websocket.state}')

    async for message in admin_websocket:
        print(message)
        await controller_websocket.send(message)
        response_controller = await controller_websocket.recv()
        
        Здесь ошибка RuntimeError: cannot call recv while another 
        coroutine is already waiting for the next message
       
        print(f'Response from controller: {response_controller}')
        await admin_websocket.send(message)

Ошибка - RuntimeError: cannot call recv while another coroutine is already waiting for the next message

Я так понимаю, что ему не нравится 2 recv(). Как это исправить?


Ответы (0 шт):