function shutdown() {
  console.log('PsiTransfer shutting down...');
  eventBus.emit('shutdown', server || httpsServer);
  if(server) {
    server.close(() => {
      server = false;
      if(!server && !httpsServer) process.exit(0);
    });
  }
  if(httpsServer) {
    httpsServer.close(() => {
      httpsServer = false;
      if(!server && !httpsServer) process.exit(0);
    });
  }
  setTimeout(function() {
    console.log('Could not close connections in time, forcefully shutting down');
    process.exit(1);
  }, 15 * 1000);
}
Naming:
sid: Group of files
key: File
fid: {sid}++{key}