0

I have a website which can have up to 500 concurrent viewers, with data updated every three seconds. Currently each user has an AJAX object which calls a web-page every three seconds which queries a DB and returns with the results.

What I would love to do is have each client get a socket to a node.js object, this node.js would poll the DB every 3 seconds for updated data, if it had updated data it would then be announced (ideally through JSON) and each client would then have the data pushed to it and update the page accordingly.

If this is possible, does anyone have a recommendation as to where I start? I am fairly familiar with JS but node.js seems to confuse me.

Thanks

1 Answers1

1

I myself have quite few experience with node.js.

It is absolutely doable and looks like the perfect use case for node.js.

I recommend starting with an Express Tutorial and later on use socket.io. I don't know which DBMS you are using, but there probably is a nice package for that as well. Just look through this list.

dave
  • 4,024
  • 2
  • 18
  • 34
  • 1
    Thanks, we're using MS SQL Server. Microsoft have released a module for it recently I believe so will check that out.. One thing I can't work out, does socket.io have to run on a different port to :80? I'll be using IISNode. It'd be great if I could have domain.com/live/view.aspx for the HTML/javascription and domain.com/live/update.js for the node application? – user1077591 Oct 31 '12 at 17:53
  • You can choose the port socket.io listens to. – dave Oct 31 '12 at 18:20
  • It looks like Socket.io doesn't work with nodeiis? Is that right? – user1077591 Nov 01 '12 at 05:35
  • It seems like it doesn't. I have no idea about nodeiis. http://stackoverflow.com/questions/9146849/code-sample-socket-io-on-iisnode-and-azure – dave Nov 01 '12 at 09:02