9

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!

Community
  • 1
  • 1
kramer65
  • 50,427
  • 120
  • 308
  • 488
  • 1
    The answer at http://stackoverflow.com/questions/16392260/which-websocket-library-to-use-with-node-js may be five months old, but sufficiently up to date to answer your questions. – chbrown Feb 12 '14 at 17:33
  • @chbrown - I read that answer as well, but that is mainly a listing of all the possibilities, instead of really giving the up and downsides and recommendations on which one to use. Again, it is good to see the options, but it wasn't clear to me which ones are better/easier than other ones. Hence this question. – kramer65 Feb 14 '14 at 09:31

1 Answers1

3

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
Yurij
  • 1,530
  • 16
  • 30
  • Thanks for the answer. Just a follow up question; you're saying that socket.io is "OK", which doesn't sound too enthousiastic to me. Would you mind sharing why you think it is "OK", and not "great"? – kramer65 Feb 13 '14 at 15:52
  • @kramer65 I think that it is great) Clear. We have experienced some troubles (with reconnection, for example or correct handling of unauthenticated socket client), but all of them are solved for us. – Yurij Feb 13 '14 at 21:47
  • Alright, thanks. Although I'm normally hoping for an "it just works" review, I think we'll be going for socket.io then. Just a last question: do you in general use the latest github build, or do you reside to older builds? – kramer65 Feb 14 '14 at 08:39
  • @kramer65 we are using the last npm version. But you should notice, that github documentation is for upcoming release, when documentation at socket.io (web-site :-) is for current (available at npm) 0.9 release. – Yurij Feb 14 '14 at 16:25