http-delayed-response
                                
                                 http-delayed-response copied to clipboard
                                
                                    http-delayed-response copied to clipboard
                            
                            
                            
                        Delayed response keeps connection open?
Hi!
Could it be the connection isn't closed properly after the response?
I'm using this on Heroku, to keep the connection open when generating a PDF.
The code is below. But recently it started throwing H15 desc="Idle connection" errors.
Any pointers?
    res.setHeader('content-type', 'text/html');
    res.write('Creating PDf... Wait for it...');
    var delayed = new DelayedResponse(req, res);
    delayed.start()
    makeFullPdf( function(pdfurl){
      console.log('PDF ready');
      var html='<br/><A HREF="'+pdfurl+'"> Open PDF</A>';
      html+='<script>window.location="'+pdfurl+'"; </script>'; //JS as we can't send headers at this point
      delayed.end(null, html);
      res.end();
    })
Thanks!
Have your code been running successfully before? If so, for how long? I don't see anything wrong with your code sample, except that you close the response twice (delayed.end will close the response).