WebSocket initiates a single request, the server does not need to wait for the customer service side, the client at any time can also send messages to the server, reducing the delay in polling time. The difference between polling and WebSocket. Once the resume is connected, the server can send the client multiple times.
HTTP-based real-time messages are quite complex, and the state of maintaining a reply in a stateless request adds complexity, and cross-domain is tortuous, and using AJAX to process request-ordered requests requires more consideration. It's not easy to communicate via Ajax. The purpose of each extension of the HTTP feature is not to increase his complexity. WebSocket can greatly simplify the links in real-time communication applications. WebSocket is about the standard websocket is an underlying network protocol that allows you to build other standard protocols on this basis. For example, use XMPP to log on to different chat servers based on the WebSocket client, because all XMPP services understand the same standard protocol. WebSocket is an innovation in Web applications. To compete with other platforms, WebSocket is part of the advanced features offered by H5 applications. Each operating system requires network capabilities, enabling applications to communicate with other hosts using sockets, which is the core function of each large platform. In many ways, making Web applications behave like operating system platforms is a HTML5 trend. The underlying network protocol APIs such as sockets do not conform to the original security model and do not have the same design style as the Web API. WebSocket provides TCP for H5 applications without weakening the network security and has a modern API. WebSocket is an important component of the HTML5 platform and a powerful tool for developers. Simply put, you need to websocket create a world-class web App. It makes up for a major flaw in HTTP that is not suitable for real-time communication. Asynchronous, bidirectional communication mode, with the Transport Layer protocol makes the WebSocket universal flexibility. Imagine all the ways you can create real-time apps with WebSocket. such as chat, collaborative document editing, massively multiplayer online games (MMO), stock trading applications, and more. WebSocket is a protocol, but there is also a websocket API, which allows your application to control the WebSocket protocol to respond to events triggered by the server. API is the development of the Iete, the agreement is formulated. Modern browsers support the WebSocket API, which includes methods and features that use full-duplex and bidirectional linking. Lets you perform such necessary actions as turning off links, sending incoming messages, and listening for server-side events.
Chapter IIwill give more details and usage examples of these APIs. The WebSocket protocol enables the client and remote server to establish full-duplex communication over the Web. Supports the transfer of binary strings and text strings, and the protocol contains the basic message framework after the handshake is opened.
Chapter IIIWill describe the details of more protocols and show you how to create your own WebSocket server. A large number of optional WebSocket servers, developer communities, and countless applications that are using websocket reflect the fiery websocket, with a large number of WebSocket servers already implemented, such as Apache Mod_pywebsocket, Jetty, Socket.io and Kaazing ' s WebSocket Gateway. This book is inspired by the sharing of our knowledge and experience in dealing with WebSocket and related technologies in the Kaazing project for many years. Kaazing has been used as an enterprise-class WebSocket gateway server and its client library for more than 5 years. Community: http://www.websocket.org/http://webplatform.org
"The Definitive Guide to HTML5 WebSocket" translation.
WebSocket Introduction (i)