async def echo_loop() -> None:
    while True:
        try:
            msg = json.loads((await websock.recv()))
        except (websockets.exceptions.ConnectionClosed, asyncio.CancelledError):
            break
        if (isinstance(msg, dict) and ('heartbeat' in msg)):
            try:
                (await websock.send(json.dumps(msg)))
            except (websockets.exceptions.ConnectionClosed, asyncio.CancelledError):
                break
async def echo_loop() -> None:
    while True:
        try:
            msg = json.loads((await websock.recv()))
        except (websockets.exceptions.ConnectionClosed, asyncio.CancelledError):
            break
        if (isinstance(msg, dict) and ('heartbeat' in msg)):
            try:
                (await websock.send(json.dumps(msg)))
            except (websockets.exceptions.ConnectionClosed, asyncio.CancelledError):
                break