A hobby project of mine is an extravagant SGF viewer. Then I see that the webpage does not require login. That gave me the idea to provide an input field for a gameid and then start to watch taht OGS game in my viewer.
I saw socketio is used and something about move for making a move and a callback for receiving a move.
Q1: Can I use the API (only watching games) without doing the authentication ?
Q2a: How is the logic, will I receive a chain of on move callbacks, that is both for black and whiteâs moves ?
Q2b: What is the general concept, because I saw that png download and sgf download is possible. Maybe it is that every move I get the full SGF ? Or that it is not possible to get a move alone every event it is played.
Oh, thank you for the hint. So treat the game like downloading an finished SGF record. That is a possible solution
Somehow I feel it a bit waste of resources for a live game, because am I going to poll the SGF every 5 seconds from the server and also the client would need to rebuild the full Gametree each poll.
{âerrorâ: âYou must be logged in to access this endpointâ}
I have no idea how to tell the server âthis gameid I want to get updatesâ
Just printing out the messages that the client receives on the websocket makes the socket close after 30seconds and only send one kind of config/info message. Sending all game events to all connected clients also sound like not efficient.
sorry that I am still lost. I can say I am quite excited because the live viewer functionality seems to be very much into reach.
Having logged in with minimal python example it works. I get the game/xxx/move messages, latency, clock etc.
But even with being logged in with the browser, I donât see these messages in the web developer tools. Or can understand how the web client does its magic.
On top now I have the question, whether I derive the player for the move simply by the odd and even move number.
In Firefox I open a game, then open the dev tools network tab and select WS, then I reload the tab showing the game. Then I click through the GET requests in the list and look at their response tab. There are all the messages:
Even though I wasnât logged my browser sent some authentication message via the WS with a jwt. So it seems that even anonymous users have such to do that.