Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which node.js socket engine should I use?

I'm at the start of a project to build a real time chat application spanning accross a website and an Android app. Since I want to prevent continuous polling on all sorts of API calls, I want to use websockets (which I have no experience with) and in the process, I thought it would be a good idea to learn node.js. So I need to start using a websockets lib for node.js. For this I see there is quite a list of options. The thing I read most about is socket.io.

Around SO I also read that socket.io v0.9 was pretty buggy, and I see multiple references about engine.io being the new backend of socket.io from socket.io version 1.0 which is supposedly "right around the corner". All these messages are from 2012 though (this one for example), and when I have a look at the socket.io website, I see they are still at v0.9, which makes me wonder a couple things:

  • is socket.io still actively being developed?
  • is socket.io a viable option at all, or do I need to reside to another library?
  • which one would you recommend for easy starting, or does node.js by now implement good sockets (by using net.Socket for example)?

All tips are welcome!

like image 852
kramer65 Avatar asked Feb 12 '14 14:02

kramer65


1 Answers

is socket.io still actively being developed?

https://github.com/learnboost/socket.io

master: authored 7 hours ago

So it's really in development now.

is socket.io a viable option at all, or do I need to reside to another library?

We are using socket.io in several projects and it is OK. Maybe you should tune your heartbeat values. For us this are:

app.io = io.listen(app);
logger.info('Setting up basic configuration.');
app.io.set('heartbeat timeout', 50);
app.io.set('heartbeat interval', 20);
app.io.set('browser client minification', true);
app.io.set('store', new io.RedisStore(ioStoreSettings)); // also don't use in-memory store, it is hardly not recommended
like image 199
Yurij Avatar answered Oct 21 '22 23:10

Yurij