> For the complete documentation index, see [llms.txt](https://alfredo-reyes-montero.gitbook.io/iot-bosch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alfredo-reyes-montero.gitbook.io/iot-bosch/devices/bosch-xdk-110/applications/language-xdk-live/mqtt/hello-world.md).

# Hello World

This program would connect to a mqtt server, to an especif topic and send "Hello World" as message each time you press a button.

1. Create a new XDK Live project.&#x20;
2. Modify .x file

## Code

```
/**
 * Welcome to XDK LIVE.
 *
 * Not sure what to do now?
 * Check out the "Getting started" guide in the Eclipse help.
 */

package main;
import platforms.xdk110;

// Create a wireless connection named 'wireless'
setup wireless : WLAN {
    ssid = "Centraal-Comunidad";
    ipConfiguration = Dhcp();
    authentification = Personal(psk = "hoyemprendo");
}

// Create a MQTT instance
setup messaging : MQTT {
    transport = wireless;
    url = "mqtt://broker.hivemq.com:1883"; // Try differents brokers iot.eclipse.org, etc. 
    cleanSession = true;
    clientId = "1234";  //Define your userID
    var Test = topic("XDK/RBTest",1);    //Define your own topic
}

// When button one is pressed, send text via MQTT
every button_one.pressed {
    messaging.Test.write("Test Write"); //Define your message
}
```

Test

Open a terminal and execute

```
# mosquitto_sub -h broker.hivemq.com -p 1883 -t XDK/RBTest
```

\*You need to change for your topic, and already have install mosquitto in your machine
