title: How emit event name can be dynamic in Node.js?
body: <p>I am trying to create dynamic EventEmitter in Node.js. So , how can the event name can be dynamic.</p>
  
  <p>Code :</p>
  
  <pre><code>var express = require('express'),
  app = express(),
  server = require('http').createServer(app),
  io = require('socket.io').listen(server);
  num = "1";
  fs = require('fs');
  
   server.listen(4000);
  
         function handler(req,res){
            fs.readFile(__dirname  + '/index.html',
            function(err,data){
             res.writeHead(500);
             res.end(data);
           });
         }
  
      app.get('/', function(req, res){
             res.sendfile(__dirname + '/index.html');
      });
  
      io.sockets.on('connection', function(socket){
  
           socket.on('send message'+num, function(data){
  
           io.sockets.emit('new message'+num, data);
      }); 
   });
  </code></pre>
  
  <p>right now in this example i have given value "1" but i want it to dynamic , so how can i get the dynamic value from a html file. So , that emit event name can be dynamic.</p>
  
  <p>Please let me know , suggest me some solution. </p>