title: send PDF file using websocket node.js
body: <p>I have the following server:</p>
  
  <pre><code> var pvsio                   = require("./pvsprocess"),
          ws                      = require("ws"),
          util                    = require("util"),
          http                    = require("http"),
          fs                      = require("fs"),
          express                 = require("express"),
          webserver               = express(),
          procWrapper             = require("./processwrapper"),
          uploadDir               = "/public/uploads",
          host                    = "0.0.0.0",
          port                    = 8082,
          workspace               = __dirname + "/public",
          pvsioProcessMap         = {},//each client should get his own process
          httpServer              = http.createServer(webserver),
          baseProjectDir          = __dirname + "/public/projects/",
          PDFDocument             = require ("pdfkit");
  
      var p, clientid = 0, WebSocketServer = ws.Server;
  
  ...
  var wsServer = new WebSocketServer({server: httpServer});
      wsServer.on("connection", function (socket) {
          var socketid =  clientid++;
          var functionMaps = createClientFunctionMaps();
          socket.on("message", function (m) {
  </code></pre>
  
  <p>Is possible send a pdf file to the client inside socket.on("message" .. function ?
  I can send message using send(), there is some function to send files?</p>
  
  <p>Thanks</p>