title: File transfer hangs (but without error) between node.js server and socket.io client
body: <p>I want to transfer a file with node.js using socket.io (socket.io-client) and delivery.</p>
  
  <p>I tried to do this on server-side:</p>
  
  <pre><code>//// server.js
  var socket  = require('socket.io').listen(5000);
  var dl  = require('delivery');
  var fs  = require('fs');
  socket.on('connect', function() {
      log( "Sockets connected" );
      delivery = dl.listen(socket);
      delivery.connect();
      delivery.on('delivery.connect',function(delivery){
          delivery.send({
              name: 'file1.zip',
              path : './file1.zip'
          });
          delivery.on('send.success',function(file){
              console.log('File sent successfully!');
          });
      });
  });
  </code></pre>
  
  <p>And this on client-side:</p>
  
  <pre><code>//// client.js
  var io  = require('socket.io-client');
  var dl  = require('delivery');
  var fs  = require('fs');
  var socket = io.connect('http://localhost:5000');
  socket.on('connection', function(socket){
      var delivery = dl.listen(socket);
      delivery.on('receive.success',function(file){
          fs.writeFile(file.name, file.buffer, function(err) {
              if(err) {
                  console.log('File could not be saved: ' + err);
              } else {
                  console.log('File ' + file.name + " saved");
              };
          });
      });
  });
  </code></pre>
  
  <p>On execution, there is no error, but it hangs.
  Server-side:</p>
  
  <pre><code>$ node server.js 
  info  - socket.io started
  debug - client authorized
  info  - handshake authorized Bbzo928wAyTjDX8v06Ic
  debug - setting request GET /socket.io/1/websocket/Bbzo928wAyTjDX8v06Ic
  debug - set heartbeat interval for client Bbzo928wAyTjDX8v06Ic
  debug - client authorized for 
  debug - websocket writing 1::
  debug - emitting heartbeat for client Bbzo928wAyTjDX8v06Ic
  debug - websocket writing 2::
  debug - set heartbeat timeout for client Bbzo928wAyTjDX8v06Ic
  debug - got heartbeat packet
  debug - cleared heartbeat timeout for client Bbzo928wAyTjDX8v06Ic
  debug - set heartbeat interval for client Bbzo928wAyTjDX8v06Ic
  </code></pre>
  
  <p>And on client-side there is no output:</p>
  
  <pre><code>$ node client.js
  </code></pre>
  
  <p>Do anyone know, what goes wrong?</p>