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

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
主站蜘蛛池模板: 武鸣县| 利川市| 彰化市| 天台县| 宿松县| 天峨县| 新巴尔虎左旗| 罗定市| 浦江县| 扎鲁特旗| 原平市| 贵南县| 宜昌市| 临颍县| 任丘市| 玉田县| 刚察县| 衡山县| 都江堰市| 民县| 无极县| 永修县| 重庆市| 桐城市| 东山县| 海南省| 渭南市| 双辽市| 荣成市| 郯城县| 宜黄县| 汝州市| 汨罗市| 龙海市| 射洪县| 许昌县| 蒲江县| 丽江市| 陆丰市| 青阳县| 浮山县|