# Procédure de test

## Installation

Pour effectuer cette procédure, il vous faut utiliser un outil client MQTT.

Chez SCorp-io nous avons une préférence pour [MQTTX ](https://mqttx.app/)mais vous êtes libre de sélectionner le client MQTT de votre choix (MQTT.FX, Mosquitto ...)

## Connexion

<figure><img src="/files/b26csjCiW5t6cY89oEf3" alt=""><figcaption></figcaption></figure>

Entrer la configuration nécessaire à la connexion au broker public SCorp-io :&#x20;

* Client ID : Fourni par SCorp-io
* Port : 8883
* Hosts : mqtts\://
* URL : broker-public-prod.scorp-io.com
* Username : Identifiant du client MQTT fourni par SCorp-io
* Password : Fourni par SCorp-io
* Certificate : CA signed server

## Souscription

Ajouter un nouvel abonnement à un topic depuis le menu ci-dessous :&#x20;

<figure><img src="/files/DfIdxdmq0Lv8Uu9306OG" alt=""><figcaption></figcaption></figure>

Ajouter le topic sur lequel vous voulez vous abonner. Pour avoir une visualisation globale de ce que vous allez publier sur votre projet, vous pouvez vous abonner à `mqtts/[PROJECT_ID]/#`

<figure><img src="/files/J5tG4vluB1daT8VPkaa6" alt=""><figcaption></figcaption></figure>

Enfin, vous pourrez constater que vos messages sont bien publiés sur le topic défini par la norme imposée par SCorp-io.

<figure><img src="/files/kZfLM0RAsqFzThlyVDjJ" alt=""><figcaption></figcaption></figure>

Cet exemple correspond à :

```
// Publication sur le topic :

mqtts/8a3bbfb2-0a47-4a05-98d2-64807bc4ca27/DDATA/automate-s7/automate-z3-1

// Du message ci-dessous :

{
  "metrics": [
    {
      "name": "pompe-1/etats",
      "timestamp": 1486144502122,
      "dataType": "Integer",
      "value": 0
    },
    {
      "name": "pompe-1/defaut",
      "timestamp": 1486144502122,
      "dataType": "Boolean",
      "value": false
    },
    {
      "name": "pompe-1/etats",
      "timestamp": 1486144502122,
      "dataType": "Float",
      "value": 1.23
    }   
  ]
}
```

## Souscrire aux commandes d'écriture en provenance de la plateforme.

Sur votre client MQTT il faut s'abonner au topic sur lequel la plateforme va écrire. Ce topic se nomme :&#x20;

```
scorpio-command-scorpio-{PROJECT_ID}
```

Et voici le format des messages :&#x20;

```
{
  topic: string,
  variableName: string,
  value: object,
  priority: number,
  timestamp: number; milliseconds
}
```


---

# 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://scorp-io.gitbook.io/guide-to-scorp-io/broker-public/procedure-de-test.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.
