1

Core features of node.js as far as I understood are (also): event-based structure and very cheap "threads" sleeping. So, it may be really good idea (and probably cheaper) to do not create periodic ajax requests, but to hold events like "user A got a new message" and let user's A connection thread sleep until this event happens.

How do you think - what would be cheaper for server (RAM, CPU) to use?

Ben Usman
  • 7,969
  • 6
  • 46
  • 66

1 Answers1

3

Take a look at socket.io for pushing data. It really is very good.

Callum Rogers
  • 15,630
  • 17
  • 67
  • 90
  • Yeap. That seems to be a really-really great solution for this kind of "event-based comet". At least at a first glance. – Ben Usman Aug 11 '11 at 22:15
  • You should also check out https://github.com/substack/dnode and http://nowjs.com/ (both built on socket.io) – generalhenry Aug 11 '11 at 22:22