Search code examples
steamsteam-web-api

Is there a way to speed up Steam API update?


I'm using Steam Web API and need to check if the achievement list for a certain user and game is updated (when user gets an achievement). I am using api.ISteamUserStats.GetUserStatsForGame.

The problem is that, even though I am querying repeatedly, the list only updates to the new data after a delay of about one minute, thus rendering my app useless.

Any ideas on how to reduce this delay or maybe suggestions for a different approach?


Solution

  • Even though your question was kind of answered in the comments, here you have some more information:

    It is nearly impossible to speed up an REST API call to -not under your control- servers like in this case. You can find some advice in this SO answer.

    This answer applied to the Steam API:

    1. Make as few calls as possible (like in the post). There are simple ways to stack requests in the Steam API like request much information at once (i.e. use ISteamUser/GetPlayerSummaries/v0002/?key=SteamAPIKey&steamids=YourSteamIDs to gather information for multiple users at once and use this data instead of a new query)

    2. Keep calls as simple as they can be. (i.e. if you just need one fact -check for one game for example- build a query for just that and don´t ask for all games and check then...)

    3. Think about caching the data - at least for certain users or data wich can be "recycled" and updated every few days/ months. (Again inspired by the other thread)

    4. Don´t call everything at once (if it is possible). It can be faster to load segments or just the information you want to show -for now. If you call every query at the beginning of your script, this could be slower. BUT: keep in mind #1 and that it is more efficient to make one large query instead of multiple smaller. This one depends completly on the query. It is more efficient to load a friend list in one query but it is more efficient to load the important data first and the less important data afterwards.

    Furthermore -obviously- check if you got enough processing power, some ram and a good connection. Just for example: I let a hosted server make the querys and pass results to me later on.