PoGo-Devs / PoGo

UWP Client for Pokemon Go
https://pogo-windows.com/
MIT License
38 stars 9 forks source link

Mapping out which requests should have multiple payloads #20

Open robertmclaws opened 8 years ago

robertmclaws commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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.