Skip to content

Commit

Permalink
updated getting started guides
Browse files Browse the repository at this point in the history
  • Loading branch information
deaflynx committed Oct 23, 2024
1 parent c10b43d commit b01f899
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ui-ngx/src/assets/getting-started/guide-arduino.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Find and install the following libraries:

The code snippet below provides an example on how to connect to a TBMQ broker using default credentials `TBMQ WebSockets MQTT Credentials`, subscribe to a topic, publish a message, and handle received message.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID, username, and password in the guide.

Please do not forget to edit following constants and variables in the sketch:

- `WIFI_AP` - name of your access point
Expand Down
2 changes: 2 additions & 0 deletions ui-ngx/src/assets/getting-started/guide-java-ws.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ In order to use Paho library in your Maven project, please make sure you have ad

The Java code below is an example of how to establish a connection to the TBMQ using default credentials `TBMQ WebSockets MQTT Credentials`, subscribe to a topic, and publish a message.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID, username, and password in the guide.

```bash
import org.eclipse.paho.mqttv5.client.IMqttMessageListener;
import org.eclipse.paho.mqttv5.client.MqttClient;
Expand Down
2 changes: 2 additions & 0 deletions ui-ngx/src/assets/getting-started/guide-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ In order to use Paho library in your Maven project, please make sure you have ad

The Java code below is an example of how to establish a connection to the TBMQ using default credentials `TBMQ WebSockets MQTT Credentials`, subscribe to a topic, and publish a message.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID, username, and password in the guide.

```bash
import org.eclipse.paho.mqttv5.client.IMqttMessageListener;
import org.eclipse.paho.mqttv5.client.MqttClient;
Expand Down
2 changes: 2 additions & 0 deletions ui-ngx/src/assets/getting-started/guide-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ MQTT.js version: 5.9.1
##### Connect to the TBMQ
The code snippet below provides a demonstration on how to connect to a TBMQ broker using default credentials `TBMQ WebSockets MQTT Credentials`, subscribe to a topic, publish a message, handle received messages and some MQTT client events.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID, username, and password in the guide.

You may paste this code into a new JavaScript file in your project, e.g. `tbmq_js_example.js`.

```bash
Expand Down
10 changes: 7 additions & 3 deletions ui-ngx/src/assets/getting-started/guide-mosquitto.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ sudo apt-get install mosquitto-clients{:copy-code}
```

##### Subscribe
To subscribe client to the MQTT topic `tbmq/demo/+` we will use the <a href='https://mosquitto.org/man/mosquitto_sub-1.html' target="_blank">mosquitto_sub</a> MQTT client.

In this guide we will use the default TBMQ credentials `TBMQ WebSockets MQTT Credentials` to subscribe to the MQTT topic `tbmq/demo/+`.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID (`-i`), username (`-u`), and password (`-P`) in the commands below.

Please copy and paste the following code into a terminal tab:

```bash
mosquitto_sub -h {:mqttHost} -p {:mqttPort} -d -u tbmq_websockets_username -t tbmq/demo/+ -q 1 -c -i tbmq -v -V mqttv5{:copy-code}
mosquitto_sub -d -q 1 -h {:mqttHost} -p {:mqttPort} -t tbmq/demo/+ -i tbmq -u tbmq_websockets_username -c -v{:copy-code}
```

##### Publish

In order to publish a message on topic `tbmq/demo/topic`, open a new terminal tab and paste the following command:

```bash
mosquitto_pub -h {:mqttHost} -p {:mqttPort} -d -u tbmq_websockets_username -t tbmq/demo/topic -m 'Hello World' -q 1 -V mqttv5{:copy-code}
mosquitto_pub -d -q 1 -h {:mqttHost} -p {:mqttPort} -t tbmq/demo/topic -u tbmq_websockets_username -m 'Hello World'{:copy-code}
```

<br>
Expand Down
2 changes: 2 additions & 0 deletions ui-ngx/src/assets/getting-started/guide-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pip3 show paho-mqtt{:copy-code}
##### Connect to the TBMQ
The script below sets up a Paho MQTT client to connect to the TBMQ broker using default credentials `TBMQ WebSockets MQTT Credentials`, handles basic MQTT operations such as publishing a message and subscribing to a topic.

In case you have changed the `TBMQ WebSockets MQTT Credentials`, don't forget to update the client ID, username, and password in the guide.

You can paste this code into a new file in your project `tbmq-python.py`.

```bash
Expand Down

0 comments on commit b01f899

Please sign in to comment.