I have been testing websockets with nodejs and a few hundred clients. To use websockets with node I used the Websocket-Node module but now I am having problems testing this on the browser.
The problem is how the client.js relies on the require function but it's not available browser side
var WebSocketClient = require('websocket').client;
Are they any ways to use node modules browser side? I tried a few things like browserify and require.js but have not had any luck with them.
I would rather avoid making big changes client side and Im not sure how different the set up would be using the websocket api trying to connect to the websocket-node one from the node server.
edit: It was easier and faster just implementing it browser side with regular websockets than trying to find a library/module to use require() browser side
The example on the Websocket-node source code doesn't require the module on the client side. They just use the WebSocket api which is straight forward:
var url = "ws://" + document.URL.substr(7).split('/')[0];
var wsCtor = window['MozWebSocket'] ? MozWebSocket : WebSocket;
this.socket = new wsCtor(url, 'whiteboard-example');