Cartesius00
Cartesius00

Reputation: 24364

Difference between socket.io and node.js

What's the difference (purpose) between socket.io and node.js projects?

Upvotes: 12

Views: 2810

Answers (2)

stan
stan

Reputation: 4995

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.

Upvotes: 9

Brad
Brad

Reputation: 163232

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.

Upvotes: 20

Related Questions