简体   繁体   中英

Difference between socket.io and node.js

socket.ionode.js项目之间的区别(目的)是什么?

They have nothing to do with each other, fundamentally.

Node.js is host for JavaScript, and is commonly used as an event-driven server.

Socket.IO is a wrapper for Web Sockets that allows simple communication between clients and servers. It also serves as a method to introduce Web-Socket-like functionality in browsers that do not natively support Web Sockets.

Your confusion likely stems from the fact that Socket.IO is hosted within Node.js projects on the server. For comparison, your question is similar to "What is the difference between cars and roads?" They are used with each other, but are not the same thing. There is probably a better analogy here, but I cannot think of one. Perhaps someone else could comment and add to this.

Simply, node.js is a run-time environment to execute JavaScript on the server.

socket.io is a framework built on top of node.js to enable web socket communication between a client and server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM