I'm trying to create a program that incorporates a kind of exchange JSONs messaging system, so there is an A or central team, of which we know its static IP and one or more B computers, which have dynamic IP and unstable.
The communication that I propose should be viable not only from B to A (including answer or not from B) but also from A to B, with the same results.
My messaging skills are limited to ZMQ, so I had raised two possible situations:
In the first one, based on PUSH-PULL sockets, A has a PULL socket and another PUSH socket, in the same way as B. As a heartbeat, B sends a JSON every X time saying "This is my IP" . It is considered reliable that information within a time range and, on the one hand we solve the communication from B to A (quite easy) and on the other B has saved an IP with which to try to contact with a minimum of reliability.
In the second, based on REQ-REP sockets. In this configuration A has a socket RES, capable of receiving and responding requests from B, which in turn has an associated REQ socket for the realization of them. The communication from B to A, again, is simple. Conversely, the idea would be to have B throwing REQ requests as a heartbeat (every half second, for example), asking "Is there something for me? Is there something for me?" Much more reliable than the first but much less efficient at the network level (I completely ignore the real cost of this type of calls).
Is there a better proposal to start with? I want to emphasize that I use ZMQ because it is what I know, but if there are much better tools / more adapted to this type of situation, I will be happy to know and / or work with them. I know Google has a kind of API for Android but I'm not talking specifically about mobile phones.