Real-time soccer event streaming

Soccer WebSocket API for Real-Time Match Events

Stream goals, cards, VAR decisions, penalties, substitutions, match status, injury time and other supported soccer events directly into live-score apps, fantasy products, media platforms, sportsbooks and analytics systems.

Goal Events Cards and VAR Heartbeats Automatic Reconnection
WebSocket Live Event JSON
{
  "event_id": "event_991827",
  "match_id": "match_74021",
  "type": "goal",
  "sequence": 184,
  "minute": 67,
  "injury_time": 0,
  "team_id": "team_18",
  "player_id": "player_301",
  "score": {
    "home": 2,
    "away": 1
  }
}
Receive Live Events Goals, cards, penalties and substitutions
Maintain Connection State Heartbeats, retries and recovery
Implementation notice: The WebSocket host, authentication method, channel names, event names, heartbeat interval, replay behaviour and payload fields on this page are illustrative placeholders. Replace them with the confirmed production specification before publishing.
Low-latency soccer data

What Is a Soccer WebSocket API?

A Soccer WebSocket API keeps a persistent connection open between your application and the data service. Instead of repeatedly requesting the same endpoint to discover whether something changed, the server can deliver supported soccer events as they become available.

This makes WebSocket delivery well suited to live scoreboards, match centres, push notifications, fantasy scoring, trading interfaces, broadcast graphics and any application where users expect updates during the match.

WebSocket should normally be combined with REST. Use REST to load the complete current match state, then use the stream for incremental changes. After a disconnect, reload the authoritative state before continuing.

Soccer Events Available Through WebSocket

Goal Events

Receive supported goals, own goals, disallowed goals, scorer, assister, match minute and updated score.

Yellow Cards

Process yellow-card events with player, team, minute and event identifiers.

Red Cards

Receive direct red cards and second-yellow dismissals where the event distinction is supported.

VAR Decisions

Update live timelines when supported reviews confirm, overturn or modify a goal, penalty, card or other decision.

Penalty Events

Process awarded, taken, scored, missed, saved or cancelled penalty events where available.

Substitutions

Receive the player entering, player leaving, team and match minute for supported substitution events.

Match Status

Track kickoff, halftime, second-half start, extra time, penalty shootout, full time and other documented states.

Injury Time

Display stoppage time and period context using the supplied match clock fields rather than assumptions.

Live Statistics

Stream supported changes to possession, shots, corners, cards, passes, saves and other match statistics.

Why Use WebSocket for Real-Time Soccer Data?

Polling can work for moderate update requirements, while WebSocket is designed for event-driven applications that need incremental updates through one persistent connection.

Requirement REST Polling Real-time delivery
WebSocket
Connection model How the client communicates Separate HTTP request for each refresh Persistent bidirectional connection
Update discovery How the client learns about changes Client asks whether data changed Server sends supported events
Best use Typical implementation Fixtures, complete match state, standings and history Goals, cards, VAR, penalties and status changes
Recovery After a connection interruption Request the current state again Reconnect, resubscribe and reconcile through REST
Production role Recommended architecture Authoritative complete state Incremental live event delivery
Connection workflow

Recommended Soccer WebSocket Architecture

1. Authenticate with your backend
2. Request active matches through REST
3. Load the complete selected match state
4. Open the WebSocket connection
5. Subscribe to one or more match channels
6. Process each unique event once
7. Monitor heartbeat messages
8. Detect stale or disconnected sessions
9. Reconnect using controlled backoff
10. Reload the latest REST state
11. Reconcile any missed events
12. Resume live event processing
Do not rely on the stream alone as the only source of match state. Network interruptions can occur. REST reconciliation provides a reliable recovery path.
Authentication

Authenticate the WebSocket Connection

The production service may authenticate through a connection header, signed token, query parameter or an initial authentication message. Follow the final documentation exactly and avoid exposing permanent private credentials in public browser code.

Illustrative Connection URL

wss://stream.example.com/v1/soccer

Illustrative Authentication Message

{
  "action": "authenticate",
  "token": "SHORT_LIVED_ACCESS_TOKEN"
}

Credential Security

  • Keep permanent API credentials on your backend
  • Issue short-lived client tokens where supported
  • Restrict token scope to required matches or channels
  • Expire and rotate compromised credentials
  • Use encrypted WSS connections in production
  • Validate every subscription on the server
Subscriptions

Subscribe to Soccer Match Events

Subscribe only to the matches or competitions your application needs. This reduces unnecessary processing and makes connection state easier to manage.

Subscribe to One Match

{
  "action": "subscribe",
  "channel": "match",
  "match_ids": [
    "match_74021"
  ]
}

Subscribe to Selected Event Types

{
  "action": "subscribe",
  "channel": "match_events",
  "match_ids": [
    "match_74021"
  ],
  "event_types": [
    "goal",
    "yellow_card",
    "red_card",
    "var_decision",
    "penalty",
    "substitution",
    "match_status"
  ]
}

Unsubscribe

{
  "action": "unsubscribe",
  "channel": "match",
  "match_ids": [
    "match_74021"
  ]
}
Event payloads

Example Goal Event

Event payloads should include a unique event identifier, match identifier, type, sequence, timestamp and enough context to update the current interface safely.

{
  "event_id": "event_991827",
  "match_id": "match_74021",
  "type": "goal",
  "sequence": 184,
  "period": "second_half",
  "minute": 67,
  "injury_time": 0,
  "team_id": "team_18",
  "player_id": "player_301",
  "assist_player_id": "player_447",
  "goal_type": "open_play",
  "status": "confirmed",
  "score": {
    "home": 2,
    "away": 1
  },
  "created_at": "2026-08-06T10:31:22Z"
}

Recommended Event Fields

Field Purpose
event_id Prevents duplicate processing
match_id Identifies the affected match
type Determines how the application handles the event
sequence Helps detect missing or out-of-order events
period and minute Places the event correctly in the match timeline
team_id and player_id Connects the event to stable soccer entities
created_at Records the provider event timestamp
Match state

Stream Match Status and Injury Time

Match clocks can pause, move into added time or enter extra time and penalty shootouts. Use the supplied state rather than calculating the official clock only from the connection duration.

Kickoff

Mark the match as live and begin processing the active period and event stream.

Halftime

Pause live clock presentation and preserve the confirmed first-half score and statistics.

Injury Time

Display regulation minute and added time using the documented injury-time fields.

Extra Time

Separate extra-time periods from regulation time where supported.

Penalty Shootout

Present shootout events and shootout score separately from the regulation result.

Full Time

Stop live indicators, load the final REST state and preserve the confirmed result.

Heartbeats

Use Heartbeats to Detect Stale Connections

A WebSocket can appear open even when messages are no longer reaching the client. Heartbeat messages help both sides confirm that the connection is active.

Illustrative Server Ping

{
  "type": "ping",
  "timestamp": "2026-08-06T10:31:30Z"
}

Illustrative Client Pong

{
  "type": "pong",
  "timestamp": "2026-08-06T10:31:30Z"
}

Heartbeat Best Practices

  • Follow the documented heartbeat interval
  • Record the last received heartbeat time
  • Mark the interface as stale after a defined timeout
  • Close and reconnect unresponsive sessions
  • Do not invent an interval until the production value is confirmed
Reconnection

Reconnect Without Missing Soccer Events

Mobile networks, proxy timeouts, deployments and temporary service interruptions can close active connections. A production client should expect this and recover automatically.

Reconnect workflow

1. Detect that the socket closed or became stale
2. Stop treating the current interface as fully live
3. Wait using exponential backoff with jitter
4. Request the latest match state through REST
5. Open a new WebSocket connection
6. Authenticate again
7. Resubscribe to required channels
8. Compare the last processed sequence
9. Apply only missing events
10. Restore the live connection indicator

Illustrative Retry Delays

Attempt 1: short delay
Attempt 2: longer delay
Attempt 3: increased delay
Later attempts: capped maximum delay

Add random jitter to prevent many clients
from reconnecting at exactly the same time.

Prevent Duplicate and Out-of-Order Events

Replayed messages and reconnect recovery can deliver events that your application has already processed. Store event IDs and sequence information before updating scores, alerts or fantasy points.

Store every processed event ID
Track the latest sequence per match
Reject exact duplicate events
Queue out-of-order events briefly
Reload state when a sequence gap remains
Reconcile final data after full time
Event Validation
When an event arrives:

1. Validate match_id
2. Validate event_id
3. Check duplicate storage
4. Compare sequence
5. Validate event type
6. Apply state change
7. Save event atomically
8. Notify connected clients

If sequence is missing:
reload authoritative state.

Recommended Stored State

Last processed event ID
Last processed sequence
Current match score
Current match status
Last heartbeat time
Last REST reconciliation time
JavaScript example

Connect to a Soccer WebSocket Stream

This browser example is illustrative. Production applications should use the official authentication method and avoid placing permanent private API credentials in public JavaScript.

const socketUrl = 'wss://stream.example.com/v1/soccer';
let socket;
let reconnectAttempt = 0;
let reconnectTimer;

function connect() {
  socket = new WebSocket(socketUrl);

  socket.addEventListener('open', () => {
    reconnectAttempt = 0;

    socket.send(JSON.stringify({
      action: 'authenticate',
      token: 'SHORT_LIVED_ACCESS_TOKEN'
    }));

    socket.send(JSON.stringify({
      action: 'subscribe',
      channel: 'match_events',
      match_ids: ['match_74021']
    }));
  });

  socket.addEventListener('message', (message) => {
    const event = JSON.parse(message.data);

    if (event.type === 'ping') {
      socket.send(JSON.stringify({
        type: 'pong',
        timestamp: event.timestamp
      }));
      return;
    }

    processSoccerEvent(event);
  });

  socket.addEventListener('close', () => {
    scheduleReconnect();
  });

  socket.addEventListener('error', () => {
    socket.close();
  });
}

function scheduleReconnect() {
  clearTimeout(reconnectTimer);

  const baseDelay = Math.min(
    1000 * Math.pow(2, reconnectAttempt),
    30000
  );

  const jitter = Math.floor(Math.random() * 1000);
  reconnectAttempt += 1;

  reconnectTimer = setTimeout(async () => {
    await reloadCurrentMatchState();
    connect();
  }, baseDelay + jitter);
}

connect();
Node.js example

Process Soccer Events on Your Backend

A backend service can maintain one upstream connection and distribute authorised updates to many application users. This can reduce duplicate connections and centralise event validation.

Backend processing pattern

1. Open one authorised upstream WebSocket connection
2. Subscribe to matches currently required by users
3. Validate and store each unique event
4. Update the central match state
5. Publish the event to internal subscribers
6. Cache the latest match state
7. Unsubscribe when the match no longer has active users
8. Load and store the final state at full time
The optimal number of upstream connections and subscriptions depends on the provider’s confirmed limits and terms.
Scaling

Scale Real-Time Soccer Data Across Many Users

Avoid opening a separate provider connection for every website visitor unless the service is explicitly designed for that model. A common architecture uses one backend ingestion layer and distributes validated updates internally.

Soccer WebSocket API
        |
        v
Live ingestion service
        |
        +-- Event validation
        +-- Duplicate protection
        +-- Match-state cache
        +-- Persistent event store
        |
        v
Internal message broker
        |
        +-- Web application
        +-- Mobile application
        +-- Notification service
        +-- Fantasy scoring
        +-- Analytics pipeline

Shared Match State

Store one current state per match rather than recomputing it for every user.

Internal Broadcasting

Distribute validated events through your own real-time layer, queue or message broker.

Subscription Management

Subscribe only while users or internal services need a match.

Backpressure Handling

Queue, batch or drop non-critical duplicate interface updates when downstream clients cannot keep pace.

Error handling

WebSocket Connection and Subscription Errors

Error type Possible cause Recommended response
Authentication failed Missing, expired or invalid token Refresh credentials and reconnect once
Subscription denied Match, competition or channel is not available to the plan Check permissions and coverage
Invalid message Unsupported action or malformed JSON Validate the payload before resending
Rate or connection limit Too many connections or subscriptions Consolidate connections and follow plan limits
Heartbeat timeout Connection is stale or network traffic stopped Close, reload state and reconnect
Sequence gap One or more events may have been missed Reload the authoritative REST state
Performance and latency

Understanding Real-Time Soccer Update Speed

WebSocket removes the polling interval between requests, but total event delivery time still depends on the original data source, processing, network location, connection quality and your own application.

Do not publish a guaranteed millisecond latency, response time, uptime or update frequency unless it has been confirmed by measured service data or a contractual service-level agreement.

Measure End to End

Compare provider event time, receipt time, processing time and user-interface display time.

Monitor Connection Health

Track connection state, heartbeat age, reconnect attempts and subscription failures.

Show Data Freshness

Display the last successful update and identify stale live interfaces.

Test Representative Matches

Evaluate multiple competitions, match states and traffic levels before production.

Commercial applications

What Can You Build With a Soccer Streaming API?

Live Score Applications

Update scoreboards, match clocks, timelines and statistics without repeatedly refreshing the entire match.

Goal Notifications

Trigger mobile, browser, email or internal alerts after validating supported goal events.

Fantasy Soccer

Apply goals, assists, cards, saves, substitutions and minutes to fantasy scoring workflows.

Sportsbooks and Trading

Combine live match events with separately available market and price data for authorised betting products.

Media and Broadcast

Power live blogs, event graphics, score overlays and match-centre components.

Analytics Automation

Feed validated live events into dashboards, alerts, models and internal decision systems.

Production checklist

Soccer WebSocket Integration Checklist

  • Use the confirmed WSS endpoint and authentication method
  • Load complete match state through REST before subscribing
  • Store unique event IDs and sequence values
  • Handle goals, cards, substitutions and status events separately
  • Respond to required heartbeat messages
  • Detect stale connections
  • Reconnect with capped exponential backoff and jitter
  • Reload REST state after reconnecting
  • Prevent duplicate event processing
  • Monitor connection, subscription and event-processing errors
  • Stop subscriptions after the match is final
  • Reconcile the final result and statistics

Soccer WebSocket API Coverage

Streaming coverage may include international competitions, domestic leagues, cups and selected youth or women’s competitions. Available event types can vary by competition, season and subscription plan.

Before launch, confirm whether the required competitions include goals, cards, VAR decisions, substitutions, penalties, line-ups, match status, injury time and live statistics through WebSocket.

Frequently asked questions

Soccer WebSocket API FAQs

What is a Soccer WebSocket API?

It is a persistent connection that can deliver supported soccer events to an application as they become available.

Which soccer events can be streamed?

Depending on coverage, events may include goals, cards, VAR decisions, penalties, substitutions, match status, injury time and live statistics.

Should I still use the REST API?

Yes. Use REST for complete state, initial loading, historical data and reconciliation after a connection interruption.

How do I prevent duplicate events?

Store unique event IDs, track sequence values and process each event idempotently.

What happens when the connection drops?

Mark the interface as stale, reconnect with controlled backoff, reload the latest REST state and resubscribe.

What are heartbeat messages?

Heartbeats help the server and client detect whether the connection is still active. Follow the confirmed heartbeat protocol.

Can I open a WebSocket directly in a browser?

Only when the authentication and plan support safe client access. Permanent private API keys should remain on your backend.

Does WebSocket guarantee a specific latency?

No. It removes polling delay, but total delivery time depends on data sourcing, processing, network conditions and application architecture.

Start streaming soccer data

Build Real-Time Soccer Experiences With WebSocket

Confirm competition and event coverage, review connection limits and begin streaming supported goals, cards, VAR decisions, penalties, substitutions and match-status updates.

Chat on WhatsApp