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

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
主站蜘蛛池模板: 体育| 梧州市| 桐梓县| 亳州市| 四平市| 三都| 屏山县| 汝南县| 尉氏县| 化德县| 当雄县| 上栗县| 曲麻莱县| 峨眉山市| 科技| 许昌市| 虹口区| 贺州市| 大埔区| 长海县| 望江县| 万年县| 达州市| 屯昌县| 石柱| 巩留县| 乌鲁木齐县| 昌宁县| 易门县| 镇坪县| 彝良县| 盐城市| 抚顺市| 金沙县| 石渠县| 汉中市| 开阳县| 泗洪县| 连南| 昆明市| 鹤峰县|