LEO Stadium

Connect your game

Same protocol for web, Unity, or any client. Create an app in the dashboard, copy the App Key, then hello.

1. Create an app

Open the dashboard → Create app → copy the App Key.

2. WebSocket URL

wss://play.leoserver.art

3. JavaScript

const ws = new WebSocket("wss://play.leoserver.art");
const APP_KEY = "leo_…";          // from dashboard
let playerKey = localStorage.getItem("leo_player_key") || "";

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: "hello",
    name: "Player",
    appKey: APP_KEY,
    playerKey: playerKey || undefined,
  }));
};

ws.onmessage = (e) => {
  const msg = JSON.parse(e.data);
  if (msg.type === "hello_ok") {
    localStorage.setItem("leo_player_key", msg.playerKey);
    ws.send(JSON.stringify({ type: "quick", game: "bluffer" }));
  }
  console.log(msg);
};

4. Unity (C#)

Use a WebSocket library (e.g. NativeWebSocket). First message after open:

using NativeWebSocket;
using UnityEngine;

public class LeoClient : MonoBehaviour {
  WebSocket ws;
  const string AppKey = "leo_…"; // from dashboard

  async void Start() {
    ws = new WebSocket("wss://play.leoserver.art");
    ws.OnOpen += () => {
      string playerKey = PlayerPrefs.GetString("leo_player_key", "");
      var hello = $"{{\"type\":\"hello\",\"name\":\"{name}\",\"appKey\":\"{AppKey}\"" +
                  (string.IsNullOrEmpty(playerKey) ? "" : $",\"playerKey\":\"{playerKey}\"") + "}";
      ws.SendText(hello);
    };
    ws.OnMessage += (bytes) => {
      var json = System.Text.Encoding.UTF8.GetString(bytes);
      Debug.Log(json);
      // parse hello_ok → save playerKey with PlayerPrefs
    };
    await ws.Connect();
  }

  void Update() { ws?.DispatchMessageQueue(); }
}

5. Next messages

{ "type": "quick", "game": "bluffer" }
{ "type": "quick", "game": "funrun" }
{ "type": "create", "game": "bluffer", "options": { "seats": 4 } }
{ "type": "join", "roomId": "K7X2PQ" }
{ "type": "start" }
{ "type": "action", "action": { "type": "bid", "count": 3, "face": 5 } }
{ "type": "action", "action": { "type": "call" } }
{ "type": "action", "action": { "type": "power" } }
{ "type": "action", "action": { "type": "jog" } }

Open dashboard Full protocol