aicometd-ng is a Python 3.10+ compatible fork of https://github.com/robertmrk/aiocometd
import asyncio
from aiocometd import Client
async def chat():
# connect to the server
async with Client("http://example.com/cometd") as client:
# subscribe to channels
await client.subscribe("/chat/demo")
await client.subscribe("/members/demo")
# listen for incoming messages
async for message in client:
topic = message["channel"]
data = message["data"]
print(f"{topic}: {data}")
if __name__ == "__main__":
asyncio.run(chat())
pip install aiocometd-ng
- Python 3.10+
- aiohttp