官术网_书友最值得收藏!

Chapter 5. Bidirectional Communication in Real Time

We have been using COMET techniques to implement bidirectional communication between a web browser and web server. Long polling is the most popular technique of achieving bidirectional communication between a web browser and web server because it works without compromising user experience and without any extra server configuration, and it works on all web browsers that support AJAX. Long polling can easily be implemented in any existing HTTP server. But the problem with long polling and other comet techniques is that none of them are suitable for building real-time apps because of HTTP overhead. This means that every time an HTTP request is made, a bunch of headers and cookie data is transferred to the server, which in turn increases the latency, therefore making it unsuitable for creating applications such as multiplayer games, chat apps, social networks, and live score websites, which require bidirectional communication in real time. Therefore, a new protocol called WebSocket was introduced, which was designed to enable bidirectional communication in real time between a web browser and WebSocket server.

In this chapter, we'll cover the following:

  • An overview of WebSocket
  • The relationship between WebSocket and HTTP
  • The interaction of WebSocket with proxy servers and firewalls
  • Implementing WebSocket using Socket.IO
  • The Socket.IO API in depth
  • Many other important things related to WebSocket and Socket.IO
主站蜘蛛池模板: 丰原市| 杭锦后旗| 法库县| 铁岭市| 潮安县| 西充县| 习水县| 尼木县| 长寿区| 五指山市| 泰和县| 金乡县| 衡南县| 九台市| 汉沽区| 新巴尔虎右旗| 漳州市| 游戏| 平罗县| 广元市| 连平县| 松阳县| 乌兰县| 炎陵县| 界首市| 泰顺县| 花莲市| 岳阳市| 中宁县| 星子县| 阿合奇县| 岫岩| 浦城县| 尉犁县| 吉林省| 汨罗市| 申扎县| 西盟| 大城县| 清远市| 峨边|