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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

WebSockets with Django

  • Malhar Lathkar

摘要

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.