Wednesday, April 27, 2016

Request cancel by client

I've spent entire morning to find out which part of my server's code cause the console message below

POST /api/channels - - ms - -

This message indicates that this request has been cancelled at some point in its life cycle, since there is no elapsed time recorded.
It turns out I've been thinking in the wrong way, it's the client, not server, stupid... stupid...


I never thought the possibility of a client browser can cancel the http request before, well, drew a lesson.

The better solution to handle this is to listen to the request's close event, and do some clean work, as referenced in this SO post

No comments:

Post a Comment