Merged node.js and javascript clients

This way it is easier to keep both implementations synced.
I used a hack/wrapper to make WebSockets behave similarly in both
environments, but it needs further testing!!