Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

Automatic token refresh + Throttle client side #220

Open WesVleuten opened 8 years ago

WesVleuten commented 8 years ago

I think automatic token refresh should be handled within the module. This is currently not the case. Is there a reason why this isn't included?

WesVleuten commented 8 years ago

IMO the delay between requests should also be handled by the module. These are API limitations and thus should be handled by this interface

LASkuma commented 8 years ago

I think you are right. I'm not sure what the exact API limit is. Do you have any idea? BTW, I think the best way to have this feature is to implement it yourself and make pull requests. I'll try to get my hands on that.

WesVleuten commented 8 years ago

I currently don't have a lot of free time, but I'll try to do it asap. I was just wondering if it was a wanted feature to have

LASkuma commented 8 years ago

I think it should be the most wanted feature ATM. Where can I find the detailed throttling information? As I have observed, hearbeat has a 1 call per 5 seconds limit and other api calls have a total of 3 calls per second limit?

BlackWolf commented 8 years ago

Just as a sidenote, a workaround for me is to check for heartbeat errors, and when I get one I execute the following:

Pokeio.playerInfo = {
    accessToken: '',
    debug: true,
    latitude: 0,
    longitude: 0,
    altitude: 0,
    locationName: '',
    provider: '',
    apiEndpoint: ''
  };

Pokeio.init(... your usual login stuff...);

This causes Pokeio to grab a new token from the server. After that, send a heartbeat again and it'll go through.

WesVleuten commented 8 years ago

I see that a solution to the token refresh issue has been resolved #226 and is currently awaiting merge, I'm currently busy with the queueing system