Whenever the server closes the connection, the client just exits directly and the case elif msg.type == aiohttp.WSMsgType.CLOSE: never executes.
elif msg.type == aiohttp.WSMsgType.CLOSE:
Client c