Hi I know the title is kinda vague, so I’ll try to make this short.
I want to make a simple script that notifies me when a list of players (my firends playing a league) are starting a game so I could have a mail with a link to their game when they are starting (this could be extended, and actually useful for someone else).
Question 1: is there a push event on th RT api for a newly created game? I just used socket. any event and got nothing while subscribed to: “player/:id”, “user/:id/games” and “notification/:id” (on both players) after creating a game
Question 2: if not, do I need to poll? using the REST api?
Question 3: What’s the normal way to get some api keys? how should I auth?
If I were trying to do this, I’d check api/v1/players/:id/games/?ended__isnull=true&ordering=-id every N seconds. (being mindful of server resources)
For GET requests, I don’t believe you have to auth. But if you find you need to later, there’s quite a few threads about it here on the forums. The first step is registering at online-go.com/oauth2/applications/
Thinking how you could get this info a bit more efficiently. If your friends all belong to a group, and you are only interested in games they play with each other, that info is available on the group page. The Watch page also has a filter whereby you can view friends’ games. Both are powered by the websocket message gamelist/query, which is still pull-based.
I have not tested this myself, but a brief search of the goban codebase ( Code search results · GitHub ) makes it seem like you can send a WS call to gamelist/count/subscribe and then you’ll get WS updates pushed to you for gamelist-count. If that’s true, you can presumably use that to know when you should fetch a new gamelist.
Ahhh, although if I understand correctly, I think this is going to give you all games, not games for a given player. So perhaps far noisier than you want. Still might be worth poking into, or taking the inspiration of manually looking through the ClientToServer and ServerToClient protocols more closely to see if there isn’t anything hiding there.