I am a relatively new developer and I’m building an iOS app with iNaturalist data.
When calling an endpoint which doesn’t require authentication such as
/places/nearby, in order to get the lowest latency, I need to keep calling this endpoint every 2 or 3 seconds, even if I’m not calling it for any particular response.
This seems like somewhat of a waste of resources and I was wondering if there is a better way of getting low latency response from the API?
I understand that websockets or web hooks might help but there is nothing on iNaturalist that indicates that this is an option.
What methods do fellow developers here use to get the lowest possible latency from the API?
The Seek app appears to have an incredibly low latency. but I have no way of measuring it.
Any help would be appreciated.
why do you think that making repeated requests every few seconds somehow improves latency?
i believe the server does do some caching so that if you make a request and then make the exact same request within a given period, you’ll get a cached response for the second request. so if the cached response is faster, is that what you’re interpreting as lower latency?
I don’t think it’s a case of it being cached because it seems to be faster even if I’m using random locations around the globe.
I thought maybe it has something to do with a “cold start” situation, though I don’t know much about this.
In any case, unless there’s some error in my code, it does seem to make subsequent calls faster.
i don’t see a pattern like what you’re describing. i did 20ish
GET /v1/places/nearby requests, varying one of the coordinates at 9-10 decimal points with each request so that each request would technically be different. i waited various amounts of times between requests. it looks like the wait for the server was anywhere from 200ish to 1000ish ms for each request, but i don’t see anything that suggests that the differences in wait times was related to how long since the last request was.
just some examples: