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

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
主站蜘蛛池模板: 密山市| 时尚| 宜川县| 牙克石市| 巴彦淖尔市| 依兰县| 汉阴县| 肇州县| 十堰市| 合水县| 河南省| 合作市| 吕梁市| 嘉鱼县| 兴义市| 东乡族自治县| 绥化市| 巨野县| 常宁市| 昌平区| 正蓝旗| 夏津县| 烟台市| 五华县| 大方县| 武乡县| 满城县| 多伦县| 永宁县| 蓬安县| 泰安市| 乌兰察布市| 苏州市| 颍上县| 政和县| 佳木斯市| 隆林| 德昌县| 江永县| 昆山市| 双峰县|