Yes, there is an easy way to do this. Effectively, what you do, you increase the timeout for your ajax call to a long timeout (say, 5 minutes). Your server receives the request and then holds it, periodically checking for new responses. Then, when the new answer is justified, it simply responds to the request and your client receives an update.
If no response is received within 5 minutes, your client will simply disconnect and start a new ajax request. Your server, if it does not respond within 5 minutes, usually simply terminates the held request in order to withdraw it from the queue.
Effectively server-side.
source
share