Back to Blog
Tutorials2026-04-16

Build Real-Time Baseball Live Scores

Create a live scoreboard with inning-by-inning updates, hits, errors, and game status.

Project Goal

Build a live baseball scoreboard that shows ongoing games with real-time updates: current score, inning-by-inning breakdown, hits, errors, and game status. Perfect for sports apps, widgets, or TV displays.

The Live Endpoint

The /baseball/live endpoint returns all currently live games grouped by league. Each game includes full score details updated in real-time.

Response Structure

Live games are grouped by league, with each game containing:

  • id, date, time - Game identification
  • status - 'IN PROGRESS', 'DELAYED', 'SUSPENDED'
  • stage - 'Regular Season', 'Playoffs', etc.
  • extra_innings - Boolean if game went past 9th
  • total_score - Quick score string like '5-3'
  • venue - Stadium name and city
  • home_team/away_team - Team info with detailed score

Score Object Details

Each team's score object provides inning-by-inning breakdown:

Building the Scoreboard UI

Create a classic baseball line score display:

Polling for Updates

Live baseball games need frequent polling. Recommended intervals:

  • During at-bats: Poll every 10-15 seconds
  • Between innings: Poll every 30-60 seconds
  • Pre-game/Post-game: Poll every 5 minutes

Detecting Score Changes

Highlight score changes for better UX:

Game Status Handling

Handle different game states appropriately:

  • IN PROGRESS - Show live indicator, current inning
  • DELAYED - Show delay reason if available
  • SUSPENDED - Show when game will resume
  • FINAL - Stop polling for this game, show final score

Advanced Features

  • Push notifications on score changes
  • Sound alerts for home runs
  • Favorite team highlighting
  • Game preview/recap integration with /baseball/games
  • Add countdown timer to next game

Mobile Optimization

For mobile devices, use a compact view showing only total scores, with expandable inning details. Reduce poll frequency when app is backgrounded to save battery and data.