Real-time table tennis event streaming

Table Tennis WebSocket API for Real-Time Match Events

Stream supported table tennis events as they happen, including point won, set won, match started, match completed, walkovers, retirements, match-status changes and tournament updates through a persistent WebSocket connection.

Point Won Set Won Match Events Live Streaming
WebSocket Live Match Event Stream
{
  "event_id": "event_tt_90018",
  "match_id": "match_tt_48291",
  "type": "point_won",
  "sequence": 73,
  "set_number": 4,
  "player_id": "player_tt_101",
  "score": {
    "player_a": 8,
    "player_b": 6
  }
}
Receive Live Events Without repeated polling
Recover Safely REST reconciliation after reconnect
Implementation notice: WebSocket host, authentication, channel names, event names, heartbeat rules, replay support, sequence behaviour, latency and payload fields on this page are illustrative until the final production specification is confirmed.
Push-based live delivery

What Is a Table Tennis WebSocket API?

A Table Tennis WebSocket API keeps a persistent connection open between your application and the live data service. Instead of repeatedly requesting the same match through REST, the server can push supported events when the match state changes.

This architecture is useful for live scoreboards, notifications, broadcaster tools, betting interfaces, real-time dashboards and any application where waiting for the next polling cycle is undesirable.

WebSocket should normally complement REST rather than replace it. REST loads authoritative state, while WebSocket delivers supported incremental updates.

Table Tennis Events Available Through WebSocket

Match Started

Detect when a scheduled match transitions into live play.

Point Won

Receive supported point events with resulting score information.

Set Started

Track transitions into a new set where that event is exposed.

Set Won

Receive the winning player and completed set score.

Match Completed

Receive final match status and winner information.

Walkover

Receive official walkover status without inventing unplayed scores.

Retirement

Preserve score and status when a player retires from a match.

Match Status Changed

Handle delayed, suspended, resumed or other documented status changes.

Serving Player Changed

Update service context where the live feed exposes this event.

Tournament Updated

Receive supported schedule, round or tournament-state changes.

Heartbeat

Confirm connection health using the production heartbeat protocol.

Replay or Resume

Recover missed events where the production stream supports replay.

Use WebSocket for Events and REST for State

The strongest live architecture uses each transport for the job it does best.

Requirement REST API WebSocket
Real-time delivery
Initial match state Full score and context Recommended Not a replacement for initial state
Point won Incremental update Requires another request Push event where supported
Set won Live progression Requires another request Push event where supported
Rankings Reference data Recommended Usually unnecessary
Historical matches Archive data Recommended Not intended for history queries
Recovery after disconnect Authoritative reconciliation Reload latest state Reconnect and resubscribe
Connection lifecycle

Recommended WebSocket Connection Flow

1. Authenticate your application
2. Open the WebSocket connection
3. Wait for connection acknowledgement
4. Subscribe to required matches or channels
5. Receive live events
6. Validate event IDs and sequence values
7. Update local match state
8. Respond to heartbeat messages
9. Detect stale or closed connections
10. Reconnect using backoff
11. Reload authoritative state through REST
12. Resubscribe to live channels
Exact authentication and connection acknowledgement behaviour must follow the production WebSocket protocol.
Illustrative connection

Connect to a Table Tennis WebSocket Stream

Browser applications should avoid exposing permanent private API keys. Use a short-lived token or authenticated backend-issued connection credential where supported.

const token = 'SHORT_LIVED_TOKEN';

const socket = new WebSocket(
  `wss://stream.example.com/v1/table-tennis?token=${encodeURIComponent(token)}`
);

socket.addEventListener('open', () => {
  console.log('WebSocket connected');
});

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

socket.addEventListener('close', () => {
  console.log('WebSocket disconnected');
});
The WebSocket host and token format are placeholders.
Subscriptions

Subscribe Only to the Matches Your Application Needs

Avoid consuming every event globally when your application displays only selected matches or tournaments.

Illustrative Match Subscription

{
  "action": "subscribe",
  "channel": "table_tennis_match_events",
  "match_ids": [
    "match_tt_48291",
    "match_tt_48292"
  ]
}

Illustrative Tournament Subscription

{
  "action": "subscribe",
  "channel": "table_tennis_tournament_events",
  "tournament_ids": [
    "tournament_211"
  ]
}

Illustrative Unsubscribe

{
  "action": "unsubscribe",
  "channel": "table_tennis_match_events",
  "match_ids": [
    "match_tt_48291"
  ]
}
Point events

Process Point-Won Events

{
  "event_id": "event_tt_90018",
  "match_id": "match_tt_48291",
  "type": "point_won",
  "sequence": 73,
  "set_number": 4,
  "player_id": "player_tt_101",
  "score": {
    "player_a": 8,
    "player_b": 6
  },
  "created_at": "2026-08-07T06:00:00Z"
}

Prefer the score supplied in the event over incrementing a local number blindly. This reduces the risk of corruption after duplicate, delayed or replayed events.

Illustrative Handler

function handlePointWon(event) {
  const match = liveMatches.get(event.match_id);

  if (!match) {
    return;
  }

  match.current_set = {
    number: event.set_number,
    player_a: event.score.player_a,
    player_b: event.score.player_b
  };

  match.last_sequence = event.sequence;

  renderMatch(match);
}
Set events

Process Set-Won Events

{
  "event_id": "event_tt_90027",
  "match_id": "match_tt_48291",
  "type": "set_won",
  "sequence": 82,
  "set_number": 4,
  "winner_id": "player_tt_101",
  "set_score": {
    "player_a": 11,
    "player_b": 8
  },
  "match_sets": {
    "player_a": 3,
    "player_b": 1
  }
}

Store the completed set in permanent match history before resetting the live point score for the next set.

Match completion

Confirm Final Match State

{
  "event_id": "event_tt_90055",
  "match_id": "match_tt_48291",
  "type": "match_completed",
  "sequence": 110,
  "winner_id": "player_tt_101",
  "sets": {
    "player_a": 4,
    "player_b": 2
  },
  "status": "completed"
}

After receiving the completion event, request the final match state through REST when possible. This gives your application a final authoritative reconciliation before stopping live processing.

Walkovers and retirements

Handle Exceptional Match Outcomes

Walkover

Store the official status and winner where supplied. Do not generate fake point or set scores.

Retirement

Preserve the real score at retirement and the player who retired.

Delayed

Keep the match subscribed if your product needs to detect when play resumes.

Cancelled

Remove the match from normal live-score processing after the official cancellation is confirmed.

Illustrative Retirement Event

{
  "event_id": "event_tt_90044",
  "match_id": "match_tt_48291",
  "type": "retirement",
  "retired_player_id": "player_tt_204",
  "winner_id": "player_tt_101",
  "sets": {
    "player_a": 2,
    "player_b": 1
  },
  "current_set": {
    "number": 4,
    "player_a": 8,
    "player_b": 6
  }
}
Duplicate protection

Make Event Processing Idempotent

A live event may be retried, replayed or received again after reconnection. Processing the same point twice can corrupt the score.

processed_events

event_id          UNIQUE
match_id
sequence
event_type
received_at
processed_at

Illustrative Event Check

if (processedEventIds.has(event.event_id)) {
  return;
}

processedEventIds.add(event.event_id);

handleEvent(event);
Use persistent storage or a durable cache in production rather than an in-memory Set when events must survive process restarts.
Sequence tracking

Detect Missing or Out-of-Order Events

A monotonically increasing sequence field can help your application identify whether an expected event was missed.

last_sequence = 72
incoming_sequence = 74

Expected:
73

Result:
A possible event gap exists.

Action:
Reload authoritative match state through REST.
Sequence semantics depend on the final production stream. Confirm whether sequencing is per match, per channel or global.
Heartbeats

Detect Stale WebSocket Connections

A connection can appear open locally even when no usable path remains between your service and the provider.

Illustrative Heartbeat Event

{
  "type": "heartbeat",
  "connection_id": "conn_123",
  "server_time": "2026-08-07T06:01:00Z"
}

Connection Health Logic

if current_time - last_heartbeat > allowed_threshold:
    mark_connection_stale()
    close_connection()
    schedule_reconnect()
Heartbeat interval and timeout thresholds must follow the production protocol rather than arbitrary values.
Reconnection

Reconnect Without Losing Match State

Reconnection should restore authoritative state before normal event processing resumes.

1. Detect connection loss
2. Mark live data as reconnecting
3. Wait using exponential backoff
4. Reload the current match through REST
5. Replace local state with authoritative state
6. Reopen the WebSocket
7. Authenticate
8. Resubscribe
9. Resume from supported replay position if available
10. Continue processing new events

Illustrative Backoff

attempt 1 → short delay
attempt 2 → longer delay
attempt 3 → longer delay
attempt 4 → capped delay

Add jitter to avoid synchronized reconnect storms.
REST reconciliation

Use REST as the Authoritative Recovery Layer

Do not assume your application has received every event after a connection interruption.

WebSocket disconnects
        ↓
GET /matches/{match_id}
        ↓
Replace local score and match status
        ↓
Reconnect WebSocket
        ↓
Resubscribe
        ↓
Apply only newer events
Backend architecture

Do Not Open One Upstream WebSocket Per Website Visitor

A scalable architecture usually keeps a controlled number of upstream provider connections and distributes validated events internally to your own users.

Table Tennis WebSocket API
          ↓
Connection Worker
          ↓
Validation + Deduplication
          ↓
Match State Store
          ↓
Message Broker / Pub-Sub
          ↓
Your WebSocket / SSE Layer
          ↓
Web and Mobile Clients

Why This Architecture Helps

  • Reduces upstream connection count
  • Centralises authentication
  • Centralises duplicate protection
  • Creates one authoritative match state
  • Makes reconnect recovery easier
  • Allows internal fan-out to many users
Scalability

Scale Real-Time Table Tennis Data Across Many Matches

Selective Subscriptions

Subscribe only to matches or tournaments required by your product.

Shared State Store

Keep the latest match state available to all application workers.

Message Broker

Fan validated events out to independent application services.

Partition by Match

Route events for the same match consistently where ordering matters.

Backpressure

Protect downstream services when they cannot process events as quickly as they arrive.

Graceful Degradation

Fall back to REST state refresh when live streaming is temporarily unavailable.

Latency

Measure Real-Time Delivery Instead of Guessing Latency

WebSocket removes the wait for a polling cycle, but end-to-end latency still depends on the source feed, processing, network path and your own application.

Useful Timestamps

provider_event_time
websocket_received_time
backend_processed_time
frontend_received_time
frontend_rendered_time

Example Measurements

Provider-to-backend latency =
websocket_received_time - provider_event_time

Backend processing latency =
backend_processed_time - websocket_received_time

End-to-end display latency =
frontend_rendered_time - provider_event_time
Do not publish fixed latency guarantees unless they have been verified and, where relevant, defined contractually.
Error handling

Handle WebSocket Errors Explicitly

Error type Recommended handling
Authentication failure Stop retrying until credentials are corrected or refreshed
Invalid subscription Log the rejected match or channel and fix the request
Temporary disconnect Reconnect using backoff and reconcile state
Sequence gap Reload authoritative match state
Malformed event Reject the event and preserve the last known valid state
Rate or connection limit Reduce subscriptions or connection count according to plan rules
Security

Protect WebSocket Credentials

  • Do not expose permanent private API keys in browser JavaScript
  • Use short-lived connection tokens where supported
  • Keep permanent credentials on your backend
  • Use encrypted WSS connections
  • Validate subscription permissions server-side
  • Rotate leaked credentials immediately
  • Log authentication failures without logging secrets
Tournament updates

Stream Supported Tournament-Level Events

A real-time table tennis product may need more than match scores. Tournament-level channels can distribute supported schedule or state changes.

Match Added

Add newly scheduled supported matches to the tournament view.

Match Time Changed

Update schedule data when a supported fixture time changes.

Round Updated

Refresh tournament progression where round events are supplied.

Match Status Changed

Update delayed, started, completed or cancelled states.

WebSocket versus polling

Why Use WebSocket Instead of Constant REST Polling?

Requirement REST Polling WebSocket
Connection model Repeated request/response Persistent connection
New-event discovery Waits for next poll Server pushes supported events
Repeated unchanged responses Possible Reduced for event-driven updates
Implementation complexity Lower Higher due to connection state and recovery
Recovery Next request retrieves state Requires reconnect plus state reconciliation
Historical queries Well suited Not the primary purpose

WebSocket is not automatically better for every endpoint. Use it for live events, and keep REST for reference and historical data.

Use cases

What Can You Build With a Table Tennis WebSocket API?

Live Scoreboards

Update points and sets without waiting for repeated page refreshes.

Mobile Notifications

Trigger validated point, set and final-result notifications.

Broadcast Graphics

Feed live match events into production graphics and overlays.

Betting Interfaces

Synchronise live match state with separately licensed market data.

Operations Dashboards

Monitor many live matches and connection health centrally.

Real-Time Analytics

Feed validated live events into streaming analytics pipelines.

Production checklist

Table Tennis WebSocket Integration Checklist

  • Keep permanent API keys on the backend
  • Load authoritative match state before subscribing
  • Subscribe only to required matches or tournaments
  • Store unique event IDs
  • Track sequence values where supported
  • Preserve completed set history
  • Respond to heartbeat requirements
  • Detect stale connections
  • Reconnect using controlled backoff
  • Reload REST state after disconnects
  • Confirm final match state after completion
  • Use a shared backend connection layer for scale
  • Measure real delivery latency
  • Respect connection and subscription limits
Frequently asked questions

Table Tennis WebSocket API FAQs

What does a Table Tennis WebSocket API do?

It can push supported live match events to your application over a persistent connection.

Can it stream point-by-point scores?

Point events may be streamed for supported matches where point-level coverage is available.

Can it stream set results?

Set-won events can be delivered where supported by the live feed.

Can it handle walkovers and retirements?

These states can be delivered as documented events without fabricating unplayed scores.

Should WebSocket replace REST?

No. REST is still recommended for initial state, recovery, historical data and final reconciliation.

What happens if the connection drops?

Reconnect with backoff, reload authoritative state through REST and resubscribe.

How do I avoid duplicate points?

Store unique event IDs and sequence values, and make event handling idempotent.

Is WebSocket always lower latency than polling?

It avoids waiting for the next polling interval, but actual end-to-end latency depends on the full data path.

Can I open a WebSocket directly from the browser?

Only if the production service supports a secure client-side authentication method such as a short-lived token. Do not expose permanent private keys.

Build real-time table tennis experiences

Stream Table Tennis Match Events Into Your Application

Use WebSocket for supported live events and REST for authoritative state, recovery and historical data.

Chat on WhatsApp