I'm not sure if that really makes sense. You are talking about retrying attempts to publish, but TCP has no concept of publishing. Easy messaging. This way you can publish or you can request information.
eg. HTTP over TCP has the verbs GET / PUT / POST (among others). All of them work through TCP. Only two actually write something (PUT / POST). It is assumed that only PUT is idempotent (that is, you should be able to perform the same operation again and again with the same result). If you have repeatedly added POSTed, I would like to re-publish something and create a new version on the server for each POST.
And the above are only recommendations for implementing PUT / POST. I would not want the HTTP library to accept this on my behalf.
Thus, the concept of resending messages at the TCP level is erroneous (note that TCP will send packets, etc., when composing a message). This is a higher level function that can use TCP at a lower level. for example, I wrote my own wrappers around HTTPClient to repeat PUTting when my remote server is temporarily unavailable or reports an error (I'm not sure if there is a repeated HTTP library)
source share