This section details a simple but realistic implementation of an asynchronous network service: an echo HTTP server. The behavior is the same as in the reactive echo server implemented in Chapter 1, An Introduction to Reactive Programming, but instead of echoing the command-line arguments, the server sends back the requests it receives on an HTTP request.
An HTTP echo server
aiohttp
The AsyncIO library does not contain an HTTP stack. In this example, as well as throughout this whole book, the aiohttp package will be used. The aiohttp package is a complete implementation of the HTTP 1.x protocol with the support of web sockets. It can be used to implement clients and servers. This is a great package to implement HTTP microservices...