Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping out which requests should have multiple payloads #20

Open
robertmclaws opened this issue Aug 24, 2016 · 4 comments
Open

Mapping out which requests should have multiple payloads #20

robertmclaws opened this issue Aug 24, 2016 · 4 comments
Assignees

Comments

@robertmclaws
Copy link

So, in my refactor, I'm working on queueing and batching, so that we can be efficient with our API calls and not spam Niantic. As @WallyCZ said, most requests also return GetHatchedEggs, GetInventory, CheckAwardedBadges, and DownloadSettings. I need to know which ones specifically do that, and which ones return other payloads. That way I can clean up this code.

Thanks!

@WallyCZ
Copy link
Contributor

WallyCZ commented Aug 24, 2016

From 0.35 batch is CheckChallenge, GetHatchedEggs, GetInventory, CheckAwardedBadges, and DownloadSettings + other single message (its always first). But not always :/ Also they started to send GetPlayer&CheckChallenge in batch in initial request
Communication looks like:
-> GetPlayer&CheckChallenge
<- check status, if its 53, then set API url and send GetPlayer&CheckChallenge again
->DownloadRemoteConfigVersion + batch (CheckChallenge, GetHatchedEggs, GetInventory, CheckAwardedBadges, and DownloadSettings)
<- response of DownloadRemoteConfigVersion + batch
-> GetAssetDigest + batch
<- response of GetAssetDigest + batch
-> LevelUpRewards + batch
-> GetMapObjects + batch
<- response of LevelUpRewards + batch
<- response of GetMapObjects + batch

But sometimes, batch looks different (it probably depends on how many messages are ready to send in queue and all those can be putted in one batch):
GetMapObjects+GetHatchedEggs+GetInventory+CheckAwardedBadges+DownloadSettings+CheckChallenge+GetHatchedEggs+GetInventory+CheckAwardedBadges+DownloadSettings (Yes, there are same messages in one batch). Also some request are allowed parallel (sorry for this I didn't see such thing in previous version)

@robertmclaws
Copy link
Author

Watching the request/response patterns, is there any throttling involved? Meaning, does it only send requests every 5 seconds, unless you're trying to capture a Pokémon or something?

Also, does capturing a Pokémon send a batch?

@ST-Apps
Copy link
Contributor

ST-Apps commented Aug 24, 2016

You check the current code for the heartbeat to see when it sends requests. It's based on both time and distance. I don't know about capturing tho.

@WallyCZ
Copy link
Contributor

WallyCZ commented Aug 24, 2016

Every request (without that initial GetPlayer&CheckChallenge) has batch, so CatchPokemon too. Throttling is maybe only in that MapUpdate, but as ST mentioned, it is done already

Update: general throttling is done when servers send status 53 - then client waits for some time and repeats request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants