You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Iv been using the library for last few weeks and it has worked for me very well, however there is one thing that I find abit inconvenient - aborting requests.
I set up a repository class for my rest api:
public class LadderRepository : MonoBehaviour {
private static string ladderFinalUrl = "ladder";
private readonly IList<RequestHelper> requests = new List<RequestHelper>();
private void Awake() {
InitUrls();
}
private void InitUrls() {
.....
}
public IPromise<LadderResponse> FetchLadder() {
var requestHelper = ComposeRequest(ladderFinalUrl);
return RestClient.Get<LadderResponse>(requestHelper);
}
}
Basically I expose IPromises for other game objects that want to communicate with the api, now my problem is aborting individual IPromises.
Ideally Id like to just call a method Abort on given IPromise to cancel given api call. I am used to abort things like this from rxjava - disposing an observable whenever I feel like.
Maybe I am missing something but right now Id have to expose given RequestHelpers to achieve what I want, which doesnt seem to be so clean. What do you think about it?
The text was updated successfully, but these errors were encountered:
Yes thats true, actually that is what I am doing at the moment. But still that has its own limitations - maybe I want to abort only some of the requests or only one particular request.
That could be also solved, yes - for example by having a Dictionary<int, RequestHelper> - where key would be promise id and value its respective request helper - then Id abort individual requests with given id.
Still not as convenient as simply calling IPromise.Abort() without anything else.
Iv been using the library for last few weeks and it has worked for me very well, however there is one thing that I find abit inconvenient - aborting requests.
I set up a repository class for my rest api:
}
Basically I expose
IPromises
for other game objects that want to communicate with the api, now my problem is aborting individualIPromises
.Ideally Id like to just call a method
Abort
on givenIPromise
to cancel given api call. I am used to abort things like this from rxjava - disposing an observable whenever I feel like.Maybe I am missing something but right now Id have to expose given
RequestHelpers
to achieve what I want, which doesnt seem to be so clean. What do you think about it?The text was updated successfully, but these errors were encountered: