title: Listen on specific url instead of port
body: <p>I am entirely new to Nodejs and trying to get familiar with it. 
  Well, currently, I am trying to push notifications on the web browser if any change happens in the database. I have piece of code which i have been using for testing purpose first. Following code works fine to send updates to browser when database table contents change:</p>
  
  <p><strong>Server.js</strong></p>
  
  <pre><code>var app = require('http').createServer(handler).listen(8000),
    io = require('socket.io').listen(app),
    fs = require('fs'),
    mysql = require('mysql'),
    connectionsArray = [],
    connection = mysql.createConnection({
      host: 'localhost',
      user: 'root',
      password: '',
      database: 'nodejs',
      port: 3306
    }),
    POLLING_INTERVAL = 3000,
    pollingTimer,
    pollingTimer_2;
  
  
  // If there is an error connecting to the database
  connection.connect(function(err) {
    // connected! (unless `err` is set)
    console.log(err);
  });
  
  
  // on server started we can load our client.html page
  function handler(req, res) {
    fs.readFile(__dirname + '/client.html', function(err, data) {
      if (err) {
        console.log(err);
        res.writeHead(500);
        return res.end('Error loading client.html');
      }
      res.writeHead(200);
      res.end(data);
    });
  }
  
  
  
  
  /*
   * This function loops on itself since there are sockets connected to the page
   * sending the result of the database query after a constant interval
   *
   */
  
  var pollingLoop = function() {
  
    // Doing the database query
    var query = connection.query('SELECT * FROM users'),
      users = []; // this array will contain the result of our db query
  
    // setting the query listeners
    query
      .on('error', function(err) {
        // Handle error, and 'end' event will be emitted after this as well
        console.log(err);
        updateSockets(err);
      })
      .on('result', function(user) {
        // it fills our array looping on each user row inside the db
        users.push(user);
      })
      .on('end', function() {
        // loop on itself only if there are sockets still connected
        if (connectionsArray.length) {
          pollingTimer = setTimeout(pollingLoop, POLLING_INTERVAL);
  
          updateSockets({
            users: users
          });
        }
      });
  
  };
  
  
  // creating a new websocket to keep the content updated without any AJAX request
  io.sockets.on('connection', function(socket) {
  
    console.log('Number of connections:' + connectionsArray.length);
    // starting the loop only if at least there is one user connected
    if (!connectionsArray.length) {
      pollingLoop();
  
    }
  
    socket.on('disconnect', function() {
      var socketIndex = connectionsArray.indexOf(socket);
      console.log('socket = ' + socketIndex + ' disconnected');
      if (socketIndex &gt;= 0) {
        connectionsArray.splice(socketIndex, 1);
      }
    });
  
    console.log('A new socket is connected!');
    connectionsArray.push(socket);
  
  });
  
  var updateSockets = function(data) {
    // adding the time of the last update
    data.time = new Date();
    // sending new data to all the sockets connected
    connectionsArray.forEach(function(tmpSocket) {
      tmpSocket.volatile.emit('notification', data);
    });
  };
  </code></pre>
  
  <p><strong>Client.html</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
  
          &lt;title&gt;Push notification server streaming on a MySQL db&lt;/title&gt;
          &lt;style&gt;
              dd,dt {
                  float:left;
                  margin:0;
                  padding:5px;
                  clear:both;
                  display:block;
                  width:100%;
  
              }
              dt {
                  background:#ddd;
              }
              time {
                  color:gray;
              }
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;time&gt;&lt;/time&gt;
          &lt;div id="container"&gt;Loading ...&lt;/div&gt;
      &lt;script src="socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
  
          // create a new websocket
          var socket = io.connect('http://localhost:8000');
          // on message received we print all the data inside the #container div
          socket.on('notification', function (data) {
          var usersList = "&lt;dl&gt;";
          $.each(data.users,function(index,user){
              usersList += "&lt;dt&gt;" + user.user_name + "&lt;/dt&gt;\n" +
                           "&lt;dd&gt;" + user.user_desc + "\n" +
                              "&lt;figure&gt; &lt;img class='img-polaroid' width='50px' src='" + user.user_img + "' /&gt;&lt;/figure&gt;"
                           "&lt;/dd&gt;";
          });
          usersList += "&lt;/dl&gt;";
          $('#container').html(usersList);
  
          $('time').html('Last Update:' + data.time);
        });
      &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now, as you can see that currently server is listening at the <code>port 8000</code>. I am just wondering that how can i change it to listen to an specific url ? Because if i am going to implement on the server project then I am not going to using the url to listen on ports ? Rather i want to use it as plain Url as I can smoothly send notification to if any user is connected to specific url?</p>
  
  <p>Any help?</p>