question

yzx2002 avatar image
yzx2002 asked

Is there any even related to the "has request in process"?

I want to create a loading page when request is process. But I have multiple requests running at the some time. Is there any event is triggered when all requests are done?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

A common technique is to use closures to drive the logic for evaluating responses from calls to the service. If you're using one of our SDKs, we make this as simple as possible with callbacks to success and error functionality.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yzx2002 avatar image yzx2002 commented ·

I'm using unity sdk. I know the callbacks to success and error function. But I have multiple request running at the same time. I want the effect that the loading page pop up when there are still requests running, when all request process done, the loading page dismiss.

It's hard to check every request's call backup function.

0 Likes 0 ·
brendan avatar image brendan yzx2002 commented ·

Well first, it's recommended that you serialize requests. Running multiple simultaneous requests could become an issue, if you have many requests in that logic flow. Can you provide more details on the specifics of your scenario?

If you have multiple simultaneous requests in flight, there's technically no way to know for certain which will finish last, so you do need to have some local tracking to determine when you have all the information required to proceed. You could do this via locking logic that tracks on outstanding requests, but this is not built into the SDKs for the reason stated.

0 Likes 0 ·
yzx2002 avatar image yzx2002 commented ·

Thank you for the answer. How to serialize the requests? Run them one by one ?

0 Likes 0 ·
brendan avatar image brendan yzx2002 commented ·

Yes, you should be waiting on the response from the previous request before issuing the next one. If you have more than a few, you should also be throttling those requests (at least a second between calls).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.