Search code examples
node.jsherokulong-polling

How to make long-requests node.js application on heroku


I want to make an application on Heroku using node.js to display various statistics.

This means that requests can take a long time to complete (more than standard 30 secs). 1. How can I increase the timeout interval so that my app wouldn't crash on request timeout? 2. How can I make long-poll requests to gradually stream data to client as long as it's being processed on server?

Thank you.


Solution

  • you can use http://socket.io for two-way server/client communication.

    according to https://devcenter.heroku.com/articles/using-socket-io-with-node-js-on-heroku, Websockets is currently not supported on Heroku. but socket.io can handle various protocols which some are supported on Heroku.