We implemented KISS state machine based on TCP timeouts and server response.
Pseudocode:
Send msg to server
if socket timeout:
reinit socket and send again
Recv from server
if recv.msg != 'ok':
send again
else
remove msg from storage
One message has from few to few hundreds Kilobytes. Messages are stored and sent as custom binary data for better compression (better that protobuffs).
ZMQ takes complexity of raw tcp sockets away and this is what we needed it for. As much and as little.