ReferenceError: module is not defined websocket.js

I want to use Websocket. So in my server.html I Have:

<html>
<head>
<script src="require.js"></script>
<script>
require(['main'], function() {

require(['websocket'], function(foo) {
    // Here, foo must be loaded and I will use it to initialize websocket server
});
});
</script>
</head>
<body>
</body>
</html>  

and in my main.js I have:

 require.config({
 baseUrl: 'node_modules/websocket',
 paths: {
    websocket: 'lib/websocket'
}
});

The folder node_module is in the same place as server.html and mains.js. the folder node_modules contains all websocket files.
The problem when I launch server.html in the browser it fails on error: ReferenceError: module is not defined. (first line in websocket.js)

module.exports = {
'server'       : require('./WebSocketServer'),
'client'       : require('./WebSocketClient'),
'router'       : require('./WebSocketRouter'),
'frame'        : require('./WebSocketFrame'),
'request'      : require('./WebSocketRequest'),
'connection'   : require('./WebSocketConnection'),
'w3cwebsocket' : require('./W3CWebSocket'),
'deprecation'  : require('./Deprecation'),
'version'      : require('./version')

};

I don't know how to fixe This. Thanks a lot for your help