Joke Collection Website - Mood Talk - Can anyone tell me the difference between node.js net.socket and socket.io?

Can anyone tell me the difference between node.js net.socket and socket.io?

socket.io is an implementation of the WebSocket protocol. You can use it to perform websocket communication. This is the application layer.

node.js net.socket is the system socket interface. Use it to You can operate Linux sockets, which are the transport layer

The websocket protocol essentially uses system sockets. It introduces sockets into http communication, that is, it does not use port 80 for http communication.

Its purpose is to establish a full-duplex connection, which can be used to solve the problem of the server client maintaining a long connection.

Socket.io is just an implementation of the websocket protocol. In addition, HTML5 also defines a corresponding API for websocket, which is implemented by client programs such as browsers. In this way, the top-level web application can directly use websocket to connect.