> For the complete documentation index, see [llms.txt](https://docs.sportradar.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sportradar.com/soccer/mls-p-and-b-tracking-websockets/connecting-to-the-tracking-websocket.md).

# Connecting to the tracking websocket

This API provides a stream of live players, ball and referee tracking data as JSON over a WebSocket connection. Please see the below for how to connect.

### Connection Protocol

This section defines how to connect to the websocket. i,e via Postman.

<details>

<summary>Submit Auth Request</summary>

1. Open websocket connection to the host and path for the data feed desired
2. Submit authentication request

a. Use the same bearer token used to access any other part of the DDE\
b.

```json
{
  "authToken": "<BEARER TOKEN>"
}
```

</details>

<details>

<summary>Successful Authentication Response</summary>

Successful authentication will return a json response\
{

```json
  "message":"Authorisation accepted",
  "level":"INFO"

}
```

</details>

<details>

<summary>Heartbeats</summary>

At this point a Heartbeat will be sent every 10seconds

```json
{
    "message": "Heartbeat sent at <ISO_DATE_TIME_STAMP>",
    "level": "INFO"
}
```

</details>

<details>

<summary>Submit a fixture request</summary>

```json
{
  "fixtureId": "<FIXTURE ID>", 
  "backfill": <BACKFILL>
}
```

1. Backfill Logic
   1. `n = null or non zero value` -> all messages from start of feed + all future messages
   2. `n = 0` -> all future messages ONLY

If the fixture exists then the data feed will commence

**Once a fixture has been requested and accepted, any further fixture requests will be ignored. The connection must be closed and a new one opened to get a new fixture feed**

</details>

### Error Responses & Handling

<details>

<summary>Authentication Error Message</summary>

```
{
    "message": "Authentication message had incorrect format",
    "level": "ERROR"
}
```

</details>

<details>

<summary>Unknown Fixture</summary>

```
{
    "message": "Could not find fixture topic soccer.tracking.enrichment.low-latency.XXXXXXXXXX",
    "level": "WARN"
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sportradar.com/soccer/mls-p-and-b-tracking-websockets/connecting-to-the-tracking-websocket.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
