Skip to content

Session Flow

A game session represents a single play session for one player in one game. Sessions are created via the Gateway API and govern the entire lifecycle of game interactions.


sequenceDiagram
    participant Operator
    participant Beexar
    participant Game as Game Frontend
    participant Wallet as Operator Wallet

    Note over Operator,Wallet: 1. Session Creation
    Operator->>Beexar: POST /api/v1/softswiss/launcher/real
    Beexar->>Beexar: Validate signature (HMAC-SHA256)
    Beexar->>Beexar: Create session (30 min TTL)
    Beexar-->>Operator: { launch_url }

    Note over Operator,Wallet: 2. Game Load
    Operator->>Game: Embed launch_url in iframe
    Game->>Beexar: Load with session token
    Beexar->>Wallet: POST /balance
    Wallet-->>Beexar: { balance: "500.00" }
    Beexar-->>Game: Show game UI with balance

    Note over Operator,Wallet: 3. Gameplay
    Game->>Beexar: Player places bet
    Beexar->>Wallet: POST /betwin (bet + win, finished=true)
    Wallet-->>Beexar: { balance: "509.80", transactions }
    Beexar-->>Game: Show result

    Note over Operator,Wallet: 4. Round with Rollback
    Game->>Beexar: Player places bet
    Beexar->>Wallet: POST /betwin (bet)
    Wallet-->>Beexar: 200 OK
    Note right of Beexar: Game engine error
    Beexar->>Wallet: POST /rollback (original bet)
    Wallet-->>Beexar: { balance: "509.80" }

The session token is a 64-character hexadecimal string that uniquely identifies the session.

PropertyValue
Format64 hex characters ([a-fA-F0-9]{64})
Created byBeexar Gateway
Used byGame frontend (passed as URL query parameter)
Lifetime30 minutes (sliding window)

The token is embedded in the launch_url:

https://games.beexar.com/dice/casinoxyz/dice-game?token=a1b2c3d4e5f6...

Demo tokens are prefixed with demo_:

https://games.beexar.com/dice/casinoxyz/dice-game/demo?token=demo_a1b2c3d4e5f6...

flowchart LR
    Start(("●")) -- "POST /api/v1/softswiss/launcher/*" --> Created
    Created -- "Game loaded" --> Active
    Active -- "Player activity" --> Active
    Active -- "TTL expired" --> Expired
    Active -- "Player exits" --> Closed
    Expired --> End_(("●"))
    Closed --> End_
StateDescription
CreatedSession token generated, awaiting game load
ActiveGame is loaded and the player is playing
ExpiredSession TTL reached without activity
ClosedPlayer closed the game or navigated away

Sessions use a sliding window mechanism:

PropertyValue
Initial TTL30 minutes
Extension triggerPlayer activity (any game action)
Extension thresholdWhen remaining TTL < 10 minutes
Extension amountReset to 30 minutes
flowchart LR
    Action["Player Action"] --> Check{"TTL < 10 min?"}
    Check -- Yes --> Extend["Extend to 30 min"]
    Check -- No --> NoOp["No change"]
    Extend --> Active["Session Active"]
    NoOp --> Active

This means an active player’s session never expires during gameplay. The session only expires after 30 minutes of inactivity.


PropertyReal-MoneyDemo
EndpointPOST /api/v1/softswiss/launcher/realPOST /api/v1/softswiss/launcher/demo
Token prefix(none)demo_
Wallet callbacksYes (/balance, /betwin, /rollback, /finish)No
Balance sourceOperator walletBeexar virtual wallet
TTL30 min sliding30 min sliding
AnalyticsRecordedNot recorded

When a session expires:

  1. Any pending bets are rolled back via /rollback
  2. Open rounds are closed via /finish
  3. The player is redirected to return_url if configured

If a player disconnects and reconnects (e.g., refreshes the page):

  1. The game frontend loads with the same session token from the URL
  2. If an in-progress round exists (slots free spins/bonus), the game resumes
  3. No duplicate transactions — idempotency via id_provider