So I created an app where the app connects to the server and tells it to do something. However the server takes a lot of time to do that thing (like an hour or so). So it doesn't make sense to connect the client to the server for that long. I want that the server must create a connection to the client to inform that he is ready to deliver the end result. Then after connection, he sends the data to the client.
I am thinking two ideas here:
I can create a server on the client side also, and client can listen for server to connect. However my clients are usually some desktop apps or mobile apps with limited resources and some of them also are behind a firewall/NAT. So even if they have a server running, I am not sure that my main server will be able to connect to them.
The client can keep checking periodically whether the results are prepared or not. This way the client does not have to maintain any server or anything. It will be the plain old client server architecture. But this costs me a lot of un-necessary traffic, as the result may be available within few minutes to few hours. A client constantly pining the server does not seems too good to me.
I first of all have no idea where to start or google this stuff. I know such a thing exists because I see all the time where servers such as "Skype" informs my desktop app that I have a new friend request, or gmail notification system where Google shows a message on my desktop when new mail is received.
Most google searches are yielding the same stuff where the client connects to the server. But the case is opposite here.
If this question is not upto standard, a few references would also be great, and I will delete this post. There's a great chance that I am just not thinking something and being stupid. Please help. Thanks.