So I am trying to interface with the real-time API for a project I am working on. Im using python and the python-socketio library. I’ve browsed around and at this point my proof of concept for just trying to get some data back / make a move in a test game looks like this:
import socketio
import requests
token = ""
sio = socketio.Client(logger=True)
auth = requests.get('https://online-go.com/api/v1/ui/config', headers={'Authorization': f'Bearer {token}'}).json()
sio.connect('https://online-go.com/socket.io/?EIO=4', transports='websocket', headers={"Authorization" : f"Bearer {token}"})
sio.emit("notification/connect", data={"auth": auth['notification_auth'], "player_id": 1010740, "username": "diobolic"})
sio.emit("chat/connect", data={"auth": auth['chat_auth'], "player_id": 1010740, "username": "diobolic"})
sio.emit("authenticate", data={"auth": auth['chat_auth'], "player_id": 1010740, "username": "diobolic"})
sio.emit('game/connect', data={'game_id': 51320670, 'player_id': 1010740, 'chat': False})
sio.emit('game/move', data={'game_id': 51320670, 'player_id': 1010740, 'move': "k10"})
To test for now, I am just grabbing my Bearer token through postman. But when I run this script, I can auth and get my chat token and notification token, but this is the only output I get.
Engine.IO connection established
Namespace / is connected
Emitting event "notification/connect" [/]
Emitting event "chat/connect" [/]
Emitting event "authenticate" [/]
Emitting event "game/connect" [/]
Emitting event "game/move" [/]
Received event "active-bots" [/]
Engine.IO connection dropped
Connection failed, new attempt in 0.70 seconds
My understanding is that game/connect
should give me back game data, but I dont see any events coming from the websocket besides active-bots
. Is there something I am missing, or is it just ignoring my emits?