Hi All,

I'm looking for a tried and true way of handling asynchronous calls to API 
endpoints returning JSON (using the iron-ajax element).  These API calls 
rely on etag matching, so it is important that the etag sent matches the 
one on the server.  I have that part working, except in certain 
circumstances, where quick succession API calls may cause an 
out-of-sequence response (and therefore can get the etag out of sync). 
 There are also multiple API endpoints (i.e. different URLs).  So, 
sometimes if quick succession calls using different endpoints are initiated 
via an iron-ajax element, it can cause issues for the response handler 
function, as the response handler currently checks the URL of the ajax 
element to know how to handle the response appropriately.  Therefore, if 
the 2nd call overwrites the URL of the ajax component before the 1st call 
response is received, when the 1st call does come back the responseHandler 
doesn't handle it appropriately.  Perhaps there is a much better and 
reliable way of checking exactly which call has returned?

I know I'm not the first person to encounter this scenario, so I'm 
wondering if someone out there can show me the enlightened path?  I'm sure 
there is a simple strategy to handle this problem, perhaps call queuing 
etc., but I'm not sure if iron-ajax has anything built-in that could help 
in that regard.

An example with some sample code would be absolutely stupendous!  I'll post 
a question on stack overflow as well and update the thread with the link.

Thanks!

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/286cf44d-ebbc-43db-afcd-5ee104e6ef73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to