Difference between express and socketio for nodejs

I am new to nodejs programming and am looking at various js that are being developed for node. My question is basic. Can someone please explain to me the difference between express and socket.

From what I know, express is middleware on which we can use template engines, such as jade, to translate data into a browser. What makes a socket? Is this a transport layer? I find it difficult to understand the difference and why we need express and socket in nodejs applications.

+4
source share
2 answers

Express is an application server. You define routes and write code to create your application pages or API responses. It is basically a port of a ruby ​​project called Sinatra. It works for the traditional HTTP request / response model.

Socket.io helps you implement a push server model for real-time functions, such as alerts / notifications, chats, or any other updates you want to make if you want them to appear in the browser without waiting for the user to click the Refresh button or something like that.

+8
source

The express HTTP server provides a model for responding to a request from the client to the server.

Socket.io provides a bi-directional communication channel between the client and server.

0
source

All Articles