Particle JavaScript SDK Rate Limit

photon
Tags: #<Tag:0x00007fe226329438>

#1

Hello,

We are using the JavaScript SDK in our web app and are hitting the rate limit for calls. Currently, we have a small wrapper around the SDK that calls login then does whatever we are trying to do. For examples, if we want to call getDevice we call login then getDevice with the auth token we got from the login. After some investigation it looks like if we call login once and then getDevice a lot we don’t hit the rate limit but if we call login every time we want to call getDevice we do.

Our solution is to make our wrapper a little smarter to actually utilize the full duration of one token rather than generate a new one every time. However, we want to make sure this is intended behaviour of SDK or if calling login every time shouldn’t make a difference.

Thanks,
Justin


#2

You definitely should not log in every time. Use the login API once and save the access token until it expires.