Real-time(Socket.IO) Integration

Getting started

Real-time push updates are available via Socket.IO. Subscribe to live events, live odds, and sport-wide feeds without polling. This page provides complete integration examples for all major frameworks.

⚠️
Token Authentication Required:Socket.IO connections now require a special token obtained from the /ws-token endpoint. This token is only available to MEGA plan subscribers. See the Token Authentication section below.
ℹ️
TipSocket.IO URL: https://live.matchstat.com
Rapid HOST: tennis-api-atp-wta-itf.p.rapidapi.com tennis-live-api.p.rapidapi.com

Note: Use the RapidAPI host corresponding to the product for which you purchased the Mega plan.

Why Token ? --> RapidAPI doesn't natively support WebSocket authentication, so we use this token-based system to verify MEGA plan access.

Tennis Live API WebSocket β€” Events Reference

This page is the single source of truth for every event exchanged over the Tennis Live API WebSocket connection. It is language-agnostic: once you have an authenticated socket connection open (see the Quick Start / language-specific integration guides), use this table to know what to emit, what to listen for, and what shape to expect back β€” without needing a separate code sample per language for every event.

ℹ️
How to use this reference:

Connect using the Quick Start snippet for your language, then simply emit/on the event names above. Every language-specific integration guide (React/Next.js, C#/.NET, etc.) points back to this page instead of re-documenting payload shapes, so this table is the only place that needs updating when the event contract changes.

Connection Lifecycle Events

These fire automatically as part of the underlying socket connection and don't need to be joined or left explicitly.

EventDirectionPayloadDescription
connectServer β†’ Clientβ€”Fired once the socket has successfully connected and authenticated.
disconnectServer β†’ Clientreason: stringFired when the socket disconnects, e.g. transport close, server-initiated, or client-initiated.
connect_errorServer β†’ Client{ message: string }Fired when a connection or auth attempt fails. A message of TOKEN_EXPIRED should trigger a token refresh and reconnect.

Single-Event Subscription (Live Score & Odds)

Used when a client wants live updates for one specific match/event.

EventDirectionPayloadDescription
join-eventClient β†’ ServereventId: numberSubscribes the socket to live updates for the given match/event. Only emit this when eventStatus === "InPlay".
leave-eventClient β†’ ServereventId: numberUnsubscribes from updates for the given match/event. Always call this on cleanup/disposal.
event-updateServer β†’ ClientLiveEvent object (score, sets, server, status)Fired whenever the match state changes β€” point won, game/set completed, status change, etc.
odds-updateServer β†’ ClientLiveOdds object (market, selections, prices)Fired whenever live odds move for the subscribed match/event.
// Example event-update payload
{
  "eventId": 123456,
  "status": "InPlay",
  "score": "6-4"
}

All-Matches Subscription

Used when a client wants a single feed covering every in-play match for a sport, rather than subscribing per match.

EventDirectionPayloadDescription
join-live-events-allClient β†’ ServersportSlug: string (default "tennis")Subscribes the socket to a combined feed of every live match for the given sport.
leave-live-events-allClient β†’ ServersportSlug: stringUnsubscribes from the combined feed. Always call this on cleanup/disposal.
live-events-all-updateServer β†’ ClientLiveEvent[] arrayFired whenever any match in the feed changes state; delivers the full updated list, not a diff.

Code example