title: How to change the current static html file to another html file in Nodejs ?
body: <p>i am trying to get my nodejs script to change the html file displayed when a certain socket.io is fired see my script below</p>
  
  <pre><code>var app = require('express')();
  var server = require('http').createServer(app);
  var bin = "casperjs";
  var args = ['server.js'];
  var io = require('socket.io').listen(server);
  server.listen(process.env.PORT);
  
  app.get('/', function (req, res) {
  res.sendfile(__dirname + '/client/index.html');
  });
  
  io.sockets.on('connection', function (socket) {
      console.log("socket connection incoming");
  
  
  
  
  socket.on('dout', function () {
  var spawn = require('child_process').spawn,
  child = spawn(bin, args);
  child.stdin.setEncoding = 'utf-8';
  
  
  
  socket.on('trout', function(data){
  child.stdin.write(data.message + '\n');
  
  
  //child.stdout.pipe(process.stdout);
  child.stdout.on('data', function (data) {
  console.log('  ' + data);
  });
  
  
  socket.on('mout', function() {
         console.log('communicatio\n');
         /*
         trying to change the html file displayed 
         to account.html from index.html
  
         i have tried this with no success 
  
  app.get('/', function (req, res) {
  res.sendfile(__dirname + '/client/index.html');
  });
  
  
         */
      }); 
  
  
  
  
  });
  // console.log(child.stdout);
  //console.log(child.stdout.pipe(write.stdout));
      });
  });
  </code></pre>
  
  <p>this is what i am trying to get to work </p>
  
  <pre><code>socket.on('mout', function() {
         console.log('communicatio\n');
         /*
         trying to change the html file displayed 
         to account.html from index.html
  
         i have tried this with no success 
  
  app.get('/', function (req, res) {
  res.sendfile(__dirname + '/client/index.html');
  });
  
  
         */
  </code></pre>
  
  <p>can anyone help me on how i can do this correctly </p>