using nodejs instead of comet for longpolling
The idea is to use nodejs instead of comet for longpolling. The intention is to spot changes in database and flush the update to several users. Any ideas ? Thank you
comet is a grouping term for ajax technologies. It's a way of doing long polling.
node.js is evented IO. Specifically you would use it to run a HTTP server.
node.js does not mix well with your current serverside (probably php). Yes you can use node.js with socket.io to do communication between client and server.
I would personally advice againts using mysql as your database for node though. It's more suited to document based noSQL databases.
I can't comment on comet but for your specific scenario I would advise you to go with socket.io for pushing the updates from the server.
Take a look at this example > https://github.com/andrewdavey/vogue
See how he is using socket.io to push the stuff to the client. MySql is not recommended but it's fairly workable.
Node.js and Comet are not the same thing. A server written in JavaScript running in Node can use Comet or WebSockets (both nicely abstracted in the module socket.io).
精彩评论