Scalable Real-Time Apps with Python and Redis: Exploring AsyncIO, FastAPI, and Pub/Sub
<p>I have recently started working on a side project, a real-time mobile board game with Unity, and I decided to use Python as the server’s programming language. In recent years, Python has introduced mature async I/O frameworks, such as AsyncIO and AnyIO. And web frameworks such as FastAPI are utilizing Python’s asynchronous features to introduce high-performance backend servers. In this article, we discuss concurrency, AsyncIO, and how we combine them with WebSocket and Redis to build a real-time application.</p>
<blockquote>
<p>In this tutorial we will be using <a href="https://upstash.com/?utm_source=Mohammad3" rel="noopener ugc nofollow" target="_blank">Upstash’s free Redis cluster</a>. Their <strong>free plan</strong> supports up to 10k free messages per day plus a free Kafka cluster. More about them in the article.</p>
</blockquote>
<h1>Let’s dive into the AsyncIO library.</h1>
<p>I found the best way to understand a topic is with a good example. So, let’s say we are building an application that connects to an external resource and then shows the result to the client. It’s actually what most of your typical backend projects are, reading from a database, searching in ElasticSearch, or even reading from a cache.</p>
<p><a href="https://itnext.io/scalable-real-time-apps-with-python-and-redis-exploring-asyncio-fastapi-and-pub-sub-79b56a9d2b94">Website</a></p>