Here is the SO link for this question, for your reference:  
http://stackoverflow.com/questions/33835907/polymer-iron-ajax-and-asynchronous-requests-etag-sync-and-response-handling


On Friday, 20 November 2015 12:41:57 UTC-8, Kelly St. John wrote:
>
> 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/9ec3a519-2863-489a-8e8c-501c69c2858b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to