# Core Concepts

## Data Stream

The continuous flow of heart rate data from the user's wearable device. The data moves through Terra's system and reaches the developer's backend in real time via a WebSocket connection. As long as the connection is open, the data keeps coming without needing to ask for it again.

Think of it like a pipe, to which multiple [producers](#producer) can pump data into, and multiple [consumers](#consumer) can connect to in order to receive that data.

## Producer

The **producer** is the Terra Real-Time SDK, which collects heart rate data (or other [supported data types](https://github.com/tryterra/gitbook-reference/blob/master/streaming-api/broken-reference/README.md)) from the wearable device and sends it to Terra’s API. It connects to the wearable using technologies like Bluetooth and ensures the data is constantly transmitted.

## Consumer

Your system that receives the heart rate data from Terra’s API. Once connected, it gets the data in real time and can use it in the app, display it to users, or store it for later use.

## Broker

In the context of Terra API, the **broker** is the intermediary that manages the real-time data stream between producers and consumers.

Terra API acts as the broker by receiving data from [producer connections](#producer) (the TerraRT SDK in your mobile app) and distributing it to [consumer connections](#consumer) (e.g., your application’s backend).

## Phone

In the context of this documentation, an Android/iOS device will be referred to as a phone. This will be an iOS or Android phone which connects to a streaming wearable, and sends data to the [broker](#broker).

You can think of the device itself as being a [producer](#producer) for all intents and purposes.

## Device

For all intents and purposes throughout this documentation, a device will be any wearable capable of [streaming data](https://github.com/tryterra/gitbook-reference/blob/master/streaming-api/broken-reference/README.md) through either a BLE or ANT+ connection.

If the wearable is a Watch OS, Apple Watch, or Samsung wearable (which have a special connection & data streaming process), this will be explicitly made clear

## Data transfer Protocols

These are means by which a [wearable](#wearable) will transfer data to a user's [phone](#phone), and can take one of the following forms.

* Bluetooth Low Energy (BLE) - most popular
* ANT+ - allows one-to-many broadcasting of data
* Custom Bluetooth protocols (Apple Watch, WatchOS, Samsung Watch...)


---

# Agent Instructions: 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:

```
GET https://docs.tryterra.co/reference/streaming-api/core-concepts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
