Improved websocket javascript.