Unity SDK

The official Unity SDK wraps everything in the Getting Started guide for you. It asks your backend for a ticket, opens the WebSocket, starts and cancels searches, answers ping checks, sends heartbeats, and reconnects when the connection drops. You write the game logic; the SDK speaks the protocol.

It is open source (Apache 2.0) and ships as readable C# source: github.com/Pairiquium/UnitySDK.

What it handles, and what it doesn't

The SDK handlesYou handle
A fresh ticket for every connection attempt, including reconnectsThe backend endpoint that mints tickets with your API key
begin_search, cancel_search, and heartbeatWhich game mode and region to search in
Replying to PING with pongGetting players to a game server once a match is found
Party messages, and heartbeats for every party memberYour friends list or lobby UI, and sharing join codes
Reconnecting with backoff and resuming a held searchYour game's UI and flow
Telling terminal errors apart from recoverable onesDeciding what to show the player

The SDK never holds your API key

Your Pairiquium API key stays on your backend. The SDK calls an endpoint you run, and that endpoint calls Pairiquium. Never put the key in a game build. See Generate a Ticket.

Requirements

  • Unity 2021.3 LTS or newer.
  • Windows or Linux desktop builds. The default transport uses System.Net.WebSockets. WebGL is not supported, and consoles need their own transport (see Custom Providers & Platforms).
  • A backend endpoint that mints tickets. The SDK needs one URL it can POST to; see Ticket Endpoint.
  • A Pairiquium account with at least one game mode. See Account Setup and Game Modes.

How it fits together

sequenceDiagram
  autonumber
  participant C as Game client
  participant B as Your backend
  participant P as Pairiquium

  C->>B: Log in
  B->>P: POST /v1/tickets (with your API key)
  P-->>B: ticket and wsEndpoint
  B-->>C: ticket and wsEndpoint
  C->>P: Open WebSocket (wsEndpoint?ticket=...)
  C->>P: begin_search
  par When a match is made
      P-->>C: MATCH_FOUND (matchId, team)
  and
      P->>B: POST match webhook
  end
From player login to a match: the ticket exchange, the WebSocket search, and the webhook to your backend.

Your ticket provider covers the first four messages: your game asks your backend for a ticket, and your backend gets one from Pairiquium. From opening the WebSocket onward, the SDK does the work. The match webhook is a separate server-to-server call that the SDK never sees; see After a Match.

In this guide

  1. Install: add the package to your project.
  2. Ticket Endpoint: the one endpoint your backend needs.
  3. Quick Start: your first search in a few lines of C#.
  4. Events & States: what the SDK tells your game.
  5. Error Handling: terminal and recoverable errors.
  6. Parties: queueing friends together.
  7. Automatic Behaviour: pings, heartbeats, reconnects, and tuning.
  8. After a Match: getting players to a game server.
  9. Custom Providers & Platforms: your own tickets or transport.
  10. Samples & Troubleshooting: working examples and common problems.

Next

Start with Install.