# Subscribe to a TilliT Topic

## Overview

When TilliT sends an MQTT message, it is sent on a specific topic only available to you in a **hierarchical** structure. Depending on how specific you want to be, you can adjust the subscriptions you make to get **exactly** the data you want.

## Subscribe to TilliT MQTT

The easiest way to receive data from TilliT MQTT Endpoint is to subscribe to all topics. This is done with the wildcard character `#`.

```
subscribe('/tenant/#')

This will receive:
 - /tenant/test
 - /tenant/another/test/
 - /tenant/another/another/test/
 - etc.
It will not receive:
 - /another
 - /another/topic
 - /tenant
```

### TilliT message topic structure

Every message that TilliT sends will have a topic structure of:

```
tenant/siteName/assetName/endpoint
 - tenant: the name of your tenant
 - siteName: the name of the site the event occured on
 - assetName: the name of the asset the event occured on
 - endpoint: the topic configured by the channel endpoint field (see Seperating Different Client Subscriptions)
```

If you want to subscribe to anything in a level, then you can use the character `+` like so:

```
/tenant/+/assetName/endpoint - receive updates on an asset across any site
/tenant/siteName/+/endpoint - receive updates on a site across any asset
/tenant/+/+/endpoint - receive updates on any site and any asset for an ednpoint
```

## Separating different client subscriptions

A Channel configured in TilliT has an optional endpoint field. By including an **identifier** here, we can easily subscribe to a specific TilliT Channel and seperate our subscriptions.

<figure><img src="https://2508759266-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh0XWAsvhQAYlvQe4wbHt%2Fuploads%2FK3lVvTyj6JG8Get2tdmz%2Fimage.png?alt=media&#x26;token=abf55b63-befa-43e2-8835-2eaff0207d36" alt=""><figcaption></figcaption></figure>
