I'm creating an application in Angular 4 which will be used for placing order for a company. After placing an order, the status of that order is updated in the back-end. But, because the API I'm using to retrieve the status is not updating the status, rather a BPM is updating the status in the API and then my Angular application is getting that status from the API. Since the front-end doesn't know when BPN updates the status in the API, it has to constantly hit the API using something like:
intervalForStatus = setInterval(() => {
someService.hitEndPoint().subscribe((data) => {
......
});
}, 5000);
But this setInterval will hit the API after every 5 seconds to fetch the status, which created unwanted traffic. Is their a way to know when the value gets updated in the API, so that the front-end can only hit the API when the status is updated?