title: How to create custom events for 'ws' Web-Socket module?
body: <p>Is it possible to create a custom event emitter and listener (like there's in socket.io) for 'ws' websocket module in NodeJS. If so then, how can I achieve it?</p>
  
  <p>// Here's what I wanna achieve (should work vice-versa):</p>
  
  <pre><code>// listening on server
  
  WebSocket.on('connection', function (ws) {
    ws.on('myCustomEvent', function(data) {
      // do something with the data
    });
  });
  
  // emitting from client
  
  socket.emit('myCustomEvent', data);
  </code></pre>