![]() ![]() The first thing we need to do is add our configuration settings. Make sure that our pacakage.json has all the additional packages for this article and run npm.install. We need to go into the directory where our Express application is. The other great benefit is that we learn how to do it ourselves. This has an added benefit in that we can break off our Socket.IO module and run it as its own application at a future point in time. We know that Socket.IO does not need Express, as all our examples have not used Express in any way. Our app, though, is going to keep Socket.IO and Express separated as much as possible with the least number of dependencies. They simplify a complex problem and most importantly, they do it well (Sails is a great example of this). ![]() I am not trying to knock down these frameworks. There are some frameworks that combine these two, but it still has to convert the request from Express into something that Socket.IO can use. The bad thing is that we will not have access to all the middleware that we set up for Express in Socket.IO. This means that Socket.IO will not interfere with Express routes that we have set up, and that’s a good thing. Socket.IO does not use HTTP like a web application. We are going to use Express and Socket.IO side by side. ![]() (For more resources related to this topic, see here.) It’s very fortunate that we just spent most of this article learning about Socket.IO it does just that! Let’s see how we are going to integrate Socket.IO with an Express application. We currently can serve web pages and respond to HTTP, but now we want to add real-time communication. We are going to add features until it is a fully usable app. In this article by Joshua Johanan, the author of the book Building Scalable Apps with Redis and Node.js, tells us that Express application is just the foundation. ![]()
0 Comments
Leave a Reply. |