Getting Started
Connect to our WebSocket API to receive real-time updates about a draft session.

WebSocket Connection

ws://localhost:3201/draft/[draftId]

Replace [draftId] with the ID of the draft you want to monitor. Authentication is handled automatically via HTTP cookies.

Key Steps

  1. Connect to the WebSocket endpoint
  2. Request draft data with get_draft message
  3. Listen for real-time updates
  4. Handle draft completion or deletion
Available Data
Information you can display in your application
  • Teams
    Team names and status
  • Picks & Bans
    Selected and banned heroes
  • Turn Timer
    Current turn and remaining time
  • Draft Status
    Waiting, countdown, in progress, or completed
  • Countdown Timer
    Time until draft begins
Migration Guide
How to update your external app from token-based to session-based authentication

Breaking Changes

OLD: localStorage tokens + Authorization headers

NEW: HTTP cookies + session authentication

Required Changes

  1. Remove localStorage authentication:// ❌ OLD - Don't use this anymore localStorage.getItem('authToken')
  2. Use session-based authentication:

    Visit the main app first to establish a session, then connect to WebSocket with cookies.

  3. Handle new auth events:// ✅ NEW - Listen for these events case 'auth_success': // Authentication successful case 'auth_failed': // Authentication failed
  4. Include cookies in WebSocket connection:

    Ensure your WebSocket client sends cookies automatically.

Quick Fix for External Apps

Option 1: Anonymous Read-Only Access (For OBS Overlays)

  1. Connect directly to WebSocket without authentication
  2. Anonymous users get read-only access to public drafts
  3. No session required - works seamlessly for overlays

Option 2: Session-based (For Interactive Apps)

  1. Open the main app (localhost:3000) in the same browser
  2. This establishes a session with cookies
  3. Your external app will now authenticate automatically

Option 3: External App Token (Coming Soon)

A dedicated token system for external applications is in development.

Contributors

© 2025 DRAFT. All rights reserved.