Python OGS WebSocket: lobby/live returning no games when filtering 19×19

Hi all,

I’m trying to connect to OGS via WebSocket and pick a live 19×19 game to monitor moves using Python. My goal is to receive a list of currently played games in the lobby, filter by numeric ranks, and select one to follow.

Here’s roughly what I’ve tried:

import json
import threading
import websocket

def on_message(ws, raw):
print(raw)  # currently nothing shows

ws = websocket.WebSocketApp(
“wss://online-go.com/ws”,
on_open=lambda ws: (
ws.send(json.dumps(\[“authenticate”, {“jwt”: “”}\])),
ws.send(json.dumps(\[“lobby/watch”, {“size”: 19}\]))
),
on_message=on_message
)

ws.run_forever()

Observations / Constraints:

  • Expanding the rank range from 20k–9d and using min_moves=0 still results in no games.

  • I am using numeric ranks as reported by OGS (no conversion to “1d, 2d” or similar).

  • I’m querying 19×19 boards specifically, and the lobby messages appear empty.

  • Python version: 3.13

  • Library: websocket-client 1.6.0

Questions:

  1. Is there a known reason why lobby/live might return empty or not include all 19×19 games?

  2. What is the recommended way to reliably get a list of live 19×19 games via WebSocket?

  3. How can I filter and pick a game once the lobby messages arrive without missing matches or entering an infinite retry loop?

Thanks in advance! Any guidance on how to correctly fetch live games and handle rank/move filtering would be appreciated.:slightly_smiling_face:

Thoughts:

Where did you get lobby/watch from?

It sounds like perhaps it’s something an AI hallucinated :squinting_face_with_tongue:

I don’t think we use the term “lobby”.

I also don’t know that we have a socket available at wss://online-go.com/ws - that also smells like AI dreaming.

You should probably be error checking whether you’re even opening a connection successfully - you need on_error and on_close handlers.

Is on_open ever called?

Our client is using wss://wsp.online-go.com and :

["gamelist/query",{"list":"live","sort_by":"rank","where":{},"from":0,"limit":50,"channel":""},1]

which you can see if you use the dev-tools on the “Watch” page:

Thanks for the suggestions. The recommendation to look at the browser dev tools on the Watch page ended up being the key. Once I inspected the WebSocket traffic there, I could see the exact messages the OGS client sends.

A few important details I discovered that may help others trying to do the same thing:

  1. The correct way to fetch the list of live games is with the gamelist/query command.

  2. This command must include a request ID, otherwise the server returns the response as [id, data] and it won’t match an event name.

  3. The response format is different from most push events — it comes back as [id, {results: [...]}].

Example request:

["gamelist/query", {
  "list": "live",
  "sort_by": "rank",
  "where": {},
  "from": 0,
  "limit": 100
}, 1]

The server responds with something like:

[1, { "results": [...] }]

Once I handled that response type correctly, I was able to:

• retrieve the list of live games
• filter them by numeric rank
• select a 19×19 game
• subscribe to it with game/connect and stream moves

Thanks again for pointing me in that direction.

1 Like