I am building a mobile application that receives data from server whenever the server has a new data available. I am using cordova and ionic framework for my mobile application and a PHP/MySQL/Apache for the API and server which the mobile application fetches data.
Is there any way on how can I retrieve data (JSON format) from my server without constantly requesting data every nth seconds using http.get
in my mobile application? Since I only need to fetch whenever it has a new data, and not all the time it has new data but sometimes, when on peak it has new data every second. Is Apache/PHP can handle this or do I need to switch to say for example nodejs or something? Thanks in advance.
BTW, i want my mobile application receives the data within a second.
My question is quite similar with this Receive update from server with mobile framework and https://softwareengineering.stackexchange.com/questions/225589/how-to-refresh-keep-up-to-date-content-in-the-browser-without-overloading-the-se but I'm still hanging right now.