How to implement node.js For updating data in my block? I have one block in which I need to update data from database while on events like vote , comment , revision or creation of node?

I have set up node.js and can broadcast message to users accessing site but I have no idea how to use it for updating data in block.

Any help will be appreciated, please suggest?

Thanks!
node.js is event based. While implementing node.js have you implemented socket.io &amp; express or you followed any other setup? By any means what you have to do in high level is,


Catch events on node CRUD or vote or if someone comments. Send these events to node server. Then emit those back to the clients.
In the front end your client javascript should listen to those events that you emit from the node server itself. Once you get those emitted events to your client just use jQuery/JavaScript in your client Javascript to update your block contents.


This is a highlevel algorithm that you have to follow. You can update your question with snippets of your code and may get more detailed answers.

EDIT # 1
Try to look in http://socket.io/get-started/chat/ for the event based implementation.
In that example you can see, a file called index.js. This is the node.js server file. And the index.html is the client. In both the files there are some events which are emitted. So I assume in your code you can add onclick function to emit an event to server. Then in the server you have to fetch the updated value. Then again emit a server event that will be received by the client.
I hope this makes sense. Well the implementation can become very complex.