websockets vs express.io - node.js

i am looking for a very lightweight framework that can very simply pass data between browser and the server. i started looking around for a possible alternative to express & socket.io and came across express.io and have a couple of questions:
1) when i look at express.io on github, it would appear that there has been no activity for a couple of years. should this be of any cause for concern? from my newbie perspective, i would think that one wants to strike a balance between stability and something that might not be under active development anymore. but i am only guessing.
2) websockets looked very interesting and i see some very recent activity there. any thoughts on if this is a good replacement for socket.io ? our application will only be running on a new html5 browser.
i have looked at quite a few possibilities (layers, kaph, locomotive, stapes, hapi, etc) but i wanted to stick closely with something that was more sinatra-like, very similar to express. i also thought perhaps i should look for recent development.
or could it be that there is really nothing better than the original socket.io & express ?
thank you very much.

socket.io is built on top of webSockets. It adds a bunch of useful features that webSockets do not have such as automatic reconnection, structured message passing, etc...
So, one would only really go back to webSockets from socket.io if you had no use for any of the extra features that socket.io adds or if you need to be compatible with some other endpoint that is only a webSocket and not socket.io.
As for express.io, here's one such discussion of a similar question: What utility of express.io VS express + socket.io?. The fact that there has been no development on it in a few years and that the domain it was using has expired seems like it is no longer being supported unless there is some other fork that is being developed. I don't know express.io very well myself, but it appears to be just be some extra glue that allows you to capture socket.io messages using express-like route definitions. It doesn't appear to really offer new capabilities that can't be done with just express and socket.io.
For you to get much else in helpful advice, I think you'd have to describe a lot more about your requirements and why express + socket.io doesn't already meet your needs.

https://pusher.com/ is a really nice software as a service that accomplishes this functionality. It's similar to socket.io and also runs on webSockets. There are a lot of other services like that out there. Pusher's free tier is not too bad, and you likely won't run over the hard constraints unless you're making enough money to pay for the premium tier of service. Their libraries are also super easy to understand.
socket.io is still a great choice, just wanted to show you that there are more options out there.

Related

Node.js Real-Time Stuff with DNode/shoe and all about load balancing

I have built a little system that uses dnode, shoe and browserify on the client, and NodeJS and dnode/shoe on the server end. I'm wondering if it is a good idea to use dnode (RPC) as the sole protocol for a real-time web application.
Let's look at the benefits of DNode or any other RPC interface. I like being able to call functions remotely (RPC). It definitely beats Ajax because you get a consistent interface for communicating from the client to the server and server to the client. I'm also betting that you get a small measure of performance over Ajax because of the HTTP overhead involved with Ajax.
However, using RPC, you have to deal with load balancing and the client connections on the server. But this goes with any websocket implementation. But, with other websocket implementation, you have a more traditional event based system, where the client listens to events from the server and responds to those events. I tried replicating this sort of interface using EventEmitters, but it's awful, and I keep getting warnings about too many handlers. Ugh!
I'm looking to achieve a lightweight, clean, interface that I can use to develop my application with. One that feels robust and is able to scale to many clients. It needs to feel solid.
I'm not really sure what my question is in writing this post. I'm tasked to update this codebase I wrote so that connections aren't lost, and it's overall more robust. I guess I'm just desperate for advice or consulting with my application. Is there someone so willing as to go face-to-face with me on discussing this topic (RPC and real-time web applications)?
Thanks for reading.
I have been investigating some of the same topics as it seemed to me than some of the RPC libs were very cool, but not altogether practical for large scale apps. I actually started with NowJS, realized it was a dead project, moved to DNode/Shoe/Browserify, and finally have moved on to SocketStream in an attempt to offload some of the dirty work to a project that has a unified goal. I really didn't want rewrite what others had already done on this subject and socketstream makes that easy. To get back to your question, as you can see on their page, SocketStream uses sticky sessions. This is a big assumption but one that probably can't be worked around at the moment without further developments. The reason I mention it is that they talk about some of the things they are working on as far as scaling goes. Might we worth a read or reaching out to the developer to see if you could talk things over with him. Good luck!

Real-time newsfeed for followers - which tools and languages?

I want to implement newsfeed for followers just like Twitter in realtime. But I'm stucked which tools will be the best for my purposes. The solution (complexed solution) should be production-ready. I've tried node.js + socket.io + rabbitmq (node-ampq, rabbitJS), but node frequently crashes... Another solution is Tornado + sockJS-tornadio, but I'm unsure (and know Python not good). Before diving into code, I just need to know which tools are ebst for my purposes and can be 'really' realtime. By 'really' I mean trully fast request-responses. I've tried RabbitMQ + PHP API + Ajax, but it's not 'really' realtime, it uses ajax instead of, for example, websockets.
The data for newsfeed will be like 'John updated its profile', 'Doe uploaded new file' and something similar.
Thanks!
What sort of crashes are they? Node has been fairly stable for some time now, at least for me.
Node is a fine solution, but you introduce some amount of complexity with communication between Node and PHP (which you look to want to solve with RabbitMQ). "Really" realtime can be easily accomplished with socket.io, and since it has multiple fallbacks is ideal for getting a wide audience. Long polling and friends do have their overhead but it isn't too much if the events aren't very frequent.
If it's easier for you to integrate the newsfeed into your PHP program and you are willing to accept the minor overhead I say go for it. Otherwise, I would invest in Node. The platform is still young, but it's matured well, IMO.
I just build a realtime web application.Users can drag items and chat in the same page.and I use tornado + jquery pending + redis as a MQ system.It works good, but I am considering to try socket.io to handle realtime requests.
tornado is kickass in terms of performance, and really easy to work with. the only problem is that you need to make sure you have adapters for databases and other blocking-by-nature sources you need to communicate with. It supports websocket of course so you can stream data to users.
If I had to implement this today, the stack I'd use is:
Redis for the data and pub/sub on channels.
Tornado as the API server.
WebSocket for the communication layer wherever possible.

Node.js: Socket.io + Express needed for real-time apps?

I have just began working with node.js and have gotten the hang of the basics.
Right now I'm trying to see if I can create my very first real-time web application using node, during my research I have seen modules like "express.js" and "socket.io' pop up very often as frameworks used for node web apps.
My question is; do I really need to learn these two in order to make real-time production level node.js applications?
Also, what other things should I look at? I heard about tempting engines being an asset, but 'm not sure of their use.
You don't need to use any modules but you give up a lot when you don't. Express.js is a great place to start. It has good documentation and makes the whole process much easier. I use jade and stylus for my css and templates.
Socket.io is again optional but if you are doing real-time updates it sure makes things a lot simpler. Socket.io deals with all of the browser differences with one api and the client will always connect using the fastest technology.
Socket.IO is mandatory for real-time applications. If you have to implement a chat, a broker, a server status tool or something like that and other natural real app, you must consider use this Node package. If your site do not require something real-time bi-directional message handler you just avoid the usage of this tool.
In case of all application needs to be made in real-time situation, you can see a more appropriate framework to approach it, like Meteor

chat application: node.js or APE?

I want to create a chat app which would use php/codeigniter to do the views and user interface. I've been reading lots of posts on stackoverflow which recommended node.js or socket.io. Yet I've also run across APE(Ajax Push Engine). I don't really know much about either and was wondering which to use.
I read up on node.js and saw lots of good things about it, but the major thing about it that worries me is that it's relatively new and doesn't have lots of real world websites testing/using it.
On the other hand, APE does. And it looks similar to node.js. But like I said, I don't know enough about either to know which one to choose.
Which one is better at creating a chat app?
Thanks!
I played a little bit with node.js, tried out socket.io - but in the end did a big project with APE.
I think, as always, there is the question of what you want to achieve. Only comparing the server parts: With node.js you get a machine that won't do anything on it's own, you need to write it yourself (or use libraries) With APE, the handling of channels and connections is already built in (compiled C). Still you need to build parts of your own logic on top with JS - or use the examples.
On the client side, socket.io provides a client framework with three commands - and APE has it's APE_JSF that handles the connections (which brings more functionality than socket.io regarding channels)
Personally, I prefer APE, even though there is a lack of documentation for beginners. However, keep in mind that APE won't deliver files/images, it's not a full Web-Server but optimized for real time push where it can handle ~10K concurrent users
Like you, I'm not familiar with APE, however socket.io on node.js comes with a chat app as it's main example app.
True, there aren't a lot of sites using Node.js right now. Socket.io, however, is probably considered Node's 'Killer App', and thus has relatively a lot of talk/work done with it.
I'm presuming APE has stable APIs, though, which socket.io might not necessarily have - The 0.7 version was a pretty broad, API-changing update, for example. This might happen less often with the publication of the socket.io spec.

Easiest way to work with WebSockets in Node.js

I want to work with WebSockets in Node.js web app, and I am looking for the easiest way to do this. I've seen so many github repositories seemingly providing some ease of use.
But, I'm just looking to see if there's one that stands out as having the most support, or most widely implemented.
I was kind of leaning towards Socket.IO but I'm not entirely sure.
Any advice?
Thanks!
use now now or socket.io.
now is an abstraction build on socket.io which allows you to define methods on a shared object across client and server. This means you dont have to interact with the stream manually and can just seemingly call methods. Do read their best practices before use though.
now also has a grouping system in build which means you can talk to clients in groups rather then one or all.
socket.io itself is recommended because of it's excellent browser support with its range of fallbacks. It's also owned/maintained by a node.js startup so it's more likely to be maintained in the future. And it also has a range of server-side socket.io implementations for platforms other then node.js so you can use the same API on multiple platforms.
If you find socket.IO too large or bloated you can go for the lightweight websocket-server. This is just a simple websocket implementation and is reasonably stable. I have personally used this if I want something which is a very minimal abstraction and if I want more low level access to the websocket server itself.
Take a look at this blog post, it's very informative...

Resources