Wednesday, 17 May 2017

How to poll another server periodically from a node.js server ?

I have a node.js server A with mongodb for database. There is another remote server B (doesn't need to be node based) which exposes a HTTP/GET API '/status' and returns either 'FREE' or 'BUSY' as the response.

When a user hits a particular API endpoint in server A(say POST /test), I wish to start polling server B's status API every minute, until server B returns 'FREE' as the response.

How can this be achieved in server A, keeping in mind that the number of concurrent users can go large ?



via Sampath Kumar

No comments:

Post a Comment