Racelink
Dokumentation · Protocol without the SDK

// Dokumentation · Fortgeschritten

Protocol without the SDK

The SDK speaks a small JSON protocol over a WebSocket. Use it directly only when the SDK cannot go where you are: another framework’s build, a tool, a test.

Diese Anleitung gibt es vorerst nur auf Englisch.

Where

ws://127.0.0.1:32123/v2 on the player’s computer. It accepts Racelink overlay packages and pages from http://localhost and http://127.0.0.1 origins only (Security). Messages are JSON.

You send

client → Racelink
{ "type": "hello", "apiVersion": 2, "instanceToken": "…" }
{ "type": "subscribe", "topics": ["car", "session"] }
{ "type": "overlay.error", "message": "…", "stack": "…" }
hello
First message. instanceToken is the token Racelink put in the page’s address (#token=…); without it the page gets no settings or permissions. "demo": { "game": "iracing" } asks for demo data on this connection.
subscribe
The topics you want. Each subscribe replaces the last one.
overlay.error
Reports an error of your page; Studio shows it to you.

Racelink sends

Racelink → client
{ "type": "ready", "apiVersion": 2, "appVersion": "…", "game": "iracing",
  "host": { "editMode": false },
  "instance": { "overlayId": "…", "settings": { … }, "actions": { "TOGGLE_VISIBILITY": 3 } },
  "permissions": { "media": true, "internet": false, "steamMessages": false } }
{ "type": "telemetry", "topic": "car", "sequence": 42, "timestamp": 1730000000000, "data": { … } }
{ "type": "settings", "values": { … } }
{ "type": "host", "host": { "editMode": true } }
{ "type": "action", "action": "TOGGLE_VISIBILITY", "count": 4 }
{ "type": "permissions", "permissions": { … } }
{ "type": "error", "code": "INVALID_MESSAGE", "message": "…" }
  • ready answers hello: the game, the instance’s settings, action counts and permissions. Draw after it.
  • telemetry carries a whole topic as it is now. A new subscriber gets the latest value of each topic at once.
  • settings, host, action and permissions come when the player changes something.
  • Error codes: INVALID_MESSAGE, API_VERSION_UNSUPPORTED, INSTANCE_UNKNOWN, DEV_MANIFEST_INVALID.

The catalog of the running Racelink

GET http://127.0.0.1:32123/v2/schema returns every topic with its rate and every field with its type and games: the same catalog as the field reference, from the Racelink the player has.