FastAPI: Task got Future attached to a different loop

This error is caused by creating an asyncio synchronization primitive such as an asyncio.Event before starting your asyncio loop, then using that primitive in the loop. To fix this, create the primitives you need to use from within the loop. This error was discovered when creating our real-time chat app example. In order to make … Read more