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.
/ws-token endpoint. This token is only available to MEGA plan subscribers. See the Token Authentication section below.https://live.matchstat.comRapid HOST:
tennis-api-atp-wta-itf.p.rapidapi.com tennis-live-api.p.rapidapi.comNote: 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.
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.
| Event | Direction | Payload | Description |
|---|---|---|---|
connect | Server β Client | β | Fired once the socket has successfully connected and authenticated. |
disconnect | Server β Client | reason: string | Fired when the socket disconnects, e.g. transport close, server-initiated, or client-initiated. |
connect_error | Server β 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.
| Event | Direction | Payload | Description |
|---|---|---|---|
join-event | Client β Server | eventId: number | Subscribes the socket to live updates for the given match/event. Only emit this when eventStatus === "InPlay". |
leave-event | Client β Server | eventId: number | Unsubscribes from updates for the given match/event. Always call this on cleanup/disposal. |
event-update | Server β Client | LiveEvent object (score, sets, server, status) | Fired whenever the match state changes β point won, game/set completed, status change, etc. |
odds-update | Server β Client | LiveOdds 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.
| Event | Direction | Payload | Description |
|---|---|---|---|
join-live-events-all | Client β Server | sportSlug: string (default "tennis") | Subscribes the socket to a combined feed of every live match for the given sport. |
leave-live-events-all | Client β Server | sportSlug: string | Unsubscribes from the combined feed. Always call this on cleanup/disposal. |
live-events-all-update | Server β Client | LiveEvent[] array | Fired whenever any match in the feed changes state; delivers the full updated list, not a diff. |