How to detect disconnection for POST request in JSON RestFul API Service PHOENIX?

I’d discourage you from even trying this. What are you trying to accomplish and why?

OK, now that’s in your head, imagine that the client crashes after you’ve sent the response and it’s reading the data. Or that the client reads the whole response, then crashes parsing it, or…

If you absolutely have to rollback if the client doesn’t display confirmation, then you need to have the client POST an acknowledgement.

[EDIT] And even then, you don’t have a way to know if the response is rendered and displayed, followed by a crash before the acknowledgement POST goes out, or that the ack POST is sent but never arrives. So you have the possibility of rolling back unnecessarily.

2 Likes