Unfortunately, your world has become a little complicated. There is no direct analogue of the PAIR/PAIR socket in more widely distributed systems.
However, if you adhere to approximately the same shape of the topology (two nodes connecting exclusively with each other and without any other nodes), you can pretty much achieve what you want using ROUTER/DEALER or even DEALER/DEALER ( as you are in the comments). These sockets are similar to REQ/REP , but they do not provide a strict template for communication with the request and response, they are completely unlimited, so you get the same thing. The only problem arises if you intend to add more nodes, after which you should start managing things a little differently, in particular, the DEALER socket does not allow you to choose which node you are sending to, it is strictly rounded by the robin.
But by doing this, you will get what you are looking for (asynchronous, bidirectional).
The ROUTER socket type may require a bit of additional complexity, since you need to track the βidentifierβ of another node in order to be able to send it back (you can get it almost for free, especially in your case with only one peer using it directly from the sent message). Since this is an exclusive pair, you can ignore the rounding uncertainty introduced by the DEALER socket and just go straight to DEALER/DEALER , which gives you an unlimited message template and does not require identifier management.
Jason source share