Read 18 socket io - 401-advanced-javascript-hanna-alemu/seattle-javascript-401d31 GitHub Wiki

What is a web-socket?

WebSockets provide a persistent connection between a client and server that both parties can use to start sending data at any time. Unlike restful APIs where the client is always initiating a request, web sockets make it possible so that the server can initiate requests as well. The client establishes a WebSocket connection through a process known as the WebSocket handshake. This process starts with the client sending a regular HTTP request to the server. A header is included in this request that informs the server that the client wishes to establish a WebSocket connection.

What is socket-io?

Socket.io uses web socket to pass data among users who are all connected to a web server. With web socket, there is no negotiation protocols and the connection remains open as long as users concerned are registering for service with the webserver. The payload is significantly less than HTTP/https protocol as well.