WebSockets with Django
摘要
One of the major limitations of the HTTP protocol is that it is a strictly unidirectional protocol, in the sense that the client has to first send a request in response to which any data is sent from the server. Also, the fact that HTTP is a stateless protocol necessitates the connection to be re-established for each subsequent request. The WebSocket protocol overcomes these limitations and enables a simultaneous two-way communication channel over a single Transmission Control Protocol (TCP) connection. In this chapter, you will be introduced to handling the WebSocket protocol in Python in general and Django in particular with the help of its Channels app.