> 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/datacore/sports-apis/3ice/datacore-streaming-api/introduction/connection-authentication.md). Agents can also search and read this documentation through its [MCP server](https://docs.sportradar.com/~gitbook/mcp).

# Connection/Authentication

Connection to the message broker is made using a *Websocket* connection and the message broker makes use of the *MQTT protocol*.

More information about how authentication works is available at <http://developer.connect.sportradar.com/token>.

The authorization call will return a number of things:

1. An endpoint parameter\
   This is an authorized url where you make a websocket connection to the message broker.
2. A client identifier\
   This is the identifier you must use when connection to the message broker
3. A list of topics\
   For each permission scope you requested you will receive a topic that you can subscribe/publish to. If your permission scopes include any 'write' permissions you will also receive a topic specific to your client for feedback from the system. Any errors for the data you send will be sent on this topic.

Some example Python code using the paho.mqtt.client library (<https://www.eclipse.org/paho/index.php?page=downloads.php>).

```
urlparts = urlparse(connection_url)
host = urlparts.netloc
client = Client(client_id=client_id, transport="websockets")
client.tls_set()
headers = {'host': host, 'Host': host}
client.ws_set_options(
    path="{}?{}".format(urlparts.path, urlparts.query),
    headers=headers
)
client.on_connect = _on_connect
client.on_message = _on_message
client.connect(host, 443, 15)
client.loop_start()

def _on_connect(client, userdata, flags, connection_result):
    print("connected")

def _on_message(client, userdata, msg):
    print("received message {}".format(msg))
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sportradar.com/datacore/sports-apis/3ice/datacore-streaming-api/introduction/connection-authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
