Skip to main content
The Slippi integration connects to a Slippi relay to monitor live Super Smash Bros. Melee games and automatically track game results.

POST /slippi/livestream

Connects to a Slippi livestream relay on the specified port to begin tracking live games.
port
number
required
The port number where the Slippi relay is listening (typically 53742)

Request Body

{
  "port": 53742
}

Response

Returns a simple success response:
"ok"
HTTP Status: 200 OK

Example Request

curl -X POST http://localhost:1337/slippi/livestream \
  -H "Content-Type: application/json" \
  -d '{"port": 53742}'

Behavior

  • If a connection already exists, it will be closed before creating a new one
  • Connects to 127.0.0.1 on the specified port
  • Automatically tracks game start, player deaths, and game end events
  • Updates player scores when games complete (unless LRAS is detected)
  • Integrates with OBS to switch scenes when configured
  • Handles Zelda/Sheik transformations during gameplay

Automatic State Updates

When connected, the following data is automatically tracked:
  • Game Start: Character selections, ports, stocks, stage
  • Stock Deaths: Remaining stocks for each player
  • Game End: Winner, final stocks, game duration, stage
  • Character Changes: Zelda ↔ Sheik transformations

Connection Events

The connection monitors for:
  • Disconnection: Automatically cleans up and sets slippiConnected to false
  • Errors: Handles connection errors gracefully

Notes

  • Connection failures are handled silently and return 200 OK
  • LRAS (L+R+A+Start) detected games do not update scores
  • Game results are stored in state.slippi.gameResults array
  • The first game requires manual port assignment via the UI

POST /slippi/disconnect

Disconnects from the active Slippi livestream.

Response

Returns a simple success response:
"ok"
HTTP Status: 200 OK

Example Request

curl -X POST http://localhost:1337/slippi/disconnect

Behavior

  • Ends the active livestream connection if one exists
  • Safe to call even if no connection is active
  • Sets slippiConnected state to false
  • Clears all game tracking data

State Structure

When connected, the Slippi state contains:
{
  slippi: {
    port1: number,              // First player's port (1-4)
    port2: number,              // Second player's port (1-4)
    character1: Character,      // First port's character
    character2: Character,      // Second port's character
    characterColor1: CharacterColor,
    characterColor2: CharacterColor,
    stocksRemaining1: number,
    stocksRemaining2: number,
    player1IsPort1?: boolean,   // Port assignment (set via UI)
    stage: MeleeStage,
    gameResults: Array<{
      stage: MeleeStage,
      stocksRemaining: number,
      player1IsWinner: boolean,
      player1Character: Character,
      player2Character: Character,
      durationSeconds: number,
      index: number
    }>,
    gameStartTimeUnix: number
  },
  slippiConnected: boolean
}

Error Handling

Connection errors are handled gracefully:
  • Failed connections return 200 OK but set slippiConnected to false
  • Disconnection events trigger automatic cleanup
  • State updates are delayed by 250ms to avoid conflicts with the UI

Build docs developers (and LLMs) love