Recently participated in a LAN chat project. Use of the WebSocket. Here is a brief introduction.
Sockets and WebSocket
Simply saying that the relationship between sockets and WebSocket is the same as Java and JavaScript. Never mind.
The Socket is a programming interface for transmitting data between the transport layer and the application layer in the TCP/IP protocol.
WebSocket is a method based on asynchronous communication between the browser and the server in HMTL5.
WebSocket and Ajax
Ajax is a technique that uses JS and XML to realize local refresh of Web pages, and can only request services from clients in one direction. When the page is displayed in real time, it can only be polled and requested every 0.5 seconds.
Server.
WebSocket is HTML5 a new protocol. The two-way communication between client and server is realized.
Applicable scenarios can be social subscription, collaborative editing, click Data, real-time update live, multimedia chat. Online education, real-time push.
Socket, WebSocket the relationship and difference between Ajax