You should take a look at Socket.IO to implement WebSockets on the server and client side.
There is a great project called duino to access Arduino using Node.js, you only need to skip all the WebSockets.
Update:. In the meantime, I published a framework for sending commands to Arduino using Node.JS, JavaScript, and WebSockets. Be sure to check out Noduino !
source share