What about having the API user handle the reconnection in that case? Then we can forget about including all this machinery entirely. That's how most things in the standard library work.