title: How to send Data to the client with out client requesting the ws server in nodejs
body: <p>I  need to convert a csv file to json format and send it to a client requesting to ws server in nodejs ,</p>
  
  <p>the file will be updated so many times so i need to send updated data  to client </p>
  
  <p>i am able to send data once it is loaded completely(like when app is started it sends all data in file to client) but when i update data in the file the updated data is being printed out on console but it is not being sent to client is their any thing wrong in my code</p>
  
  <p>my node.js code:</p>
  
  <pre><code>var ts = require('tail-stream');
  var Converter = require("csvtojson").Converter;
  var converter = new Converter({constructResult:false}); //for big csv data
  
  var WebSocketServer = require('websocket').server;
  var http = require('http');
  
  var server = http.createServer(function(request, response) {
      // process HTTP request. Since we're writing just WebSockets server
      // we don't have to implement anything.
      response.write('hello');
      console.log('in http server \n');
  });
  server.listen(1337, function() { });
  
  // create the server
  wsServer = new WebSocketServer({
      httpServer: server
  });
  
  // WebSocket server
  wsServer.on('request', function(request) {
     var connection = request.accept(null, request.origin);
  
      console.log('wsserver');
      connection.send('ws server');
  
      converter.on("record_parsed", function (jsonObj) {
     console.log(jsonObj); //here is your result json object
     connection.send(jsonObj);
  
  });
  
  
  var tstream = ts.createReadStream('log.csv', {
      beginAt: 0,
      onMove: 'follow',
      detectTruncate: false,
      onTruncate: 'end',
      endOnError: false
  });
  
  
  tstream.pipe(converter);
  });
  </code></pre>