I am trying to create a python application that can continuously receive data from a webserver. This python application will be running on multiple personal computers, and whenever new data is available it will receive it. I realize that I can do this either by long polling or web sockets, but the problem is that sometimes data won't be transferred for days and in that case long polling or websockets seem to be inefficient. I won't be needing that long of a connection but whenever data is available I need to be able to push it to the application. I have been reading about webhooks and it seems that if I can have a url to post that data to, I won't need to poll. But I am confused as to how each client would have a callback url because in that case a client would have to act as a server. Are there any libraries that help in getting this done? Any kind of resources that you can point me to would be really helpful!
There is no way to send data to the client without having some kind of connection, e.g. either websockets or (long) polling done by the client. While it would be possible in theory to open a listener socket on the client and let the web server could connect to and sent the data to this socket, this will not work in reality. The main reason for thi is, that the client is often inside an internal network not reachable from outside, i.e. a typical home setup with multiple computers behind a single IP or a corporate setup with a firewall in between. In this case it is only possible to establish a connection from inside to outside, but not the other way.
Is it possible to implement webhooks on regular clients?