I have been following this answer on stackoverflow: How can I implement asyncio websockets in a class?
But the problem I cannot resolve right now is that the instance of EchoWebsocket Class can only send one message. I am unable to send multiple messages / custom message on every communication.
async def main():
async with EchoWebsocket() as echo:
await echo.send("Hello!")
print(await echo.receive()) # "Hello!"
Here is what i want to do, create an instance of EchoWebsocket class and return the connection back to the user. So the user can always use send method to communicate with the server.
Thank you for your help.