Optimise the opening and closing of sockets : redesign communication between apps
To optimise the sockets, it is better to define 1 socket REP per app so that only simple messages are sent. Do not block, the REP answers immediately as Acknowledge. It is simpler to implement the timeouts. The publisher and subscriber use this common message queue. A complete redesign is required. All sockets must have a lifetime greater than a simple request: sockets connected to server also live the time of the process.