Hello, world! (MQTTwrapper Class Demo)

(No library is wrapped...)

Go back to example list / Go to the repository of this example on GitHub

HOST (Where is the broker):

URL:
://:/

Preset ...

SEND (Behave as a publisher):

topic =

RECV (Behave as a subscriber):

topic =


README (What is this?):

This is a control panel to try to use the MQTTwrapper class. This library makes your web browser an MQTT-over-WebSocket speaker. And then the protocol is very helpful to send/receive text data (also byte stream) from/to the UNIX stdin/stdout.

Only one simple application is required to connect to the stdin/stdout. That is "Mosquitto."

Try to use me by the following steps.

How to Use Me:

0-1) [PREP.] Install Mosquitto

The installation instructions are on this page.

0-2) [PREP.] Write the configuration for Mosquitto

Copy and save the following text as the file "mosquitto.local.conf" in your favor directory.

1) Start an MQTT broker

Type the following command on your UNIX terminal.

2) Connect me to the MQTT broker

In the "HOST" section, fill in the URL form (Specify "ws://localhost:8000/" to use the above MQTT broker, of course, it's OK to use another broker.) and push the "Connect" button. Then, wait for the button name to be "CONNECTED."

3) Start subscribing

First, decide on the MQTT topic name for this trial. Next, type the topic name into the "topicname" field in the "RECV" section and push the "Start" button in the same section. And also, type the following command on your UNIX terminal.

"TOPIC" is the topic name you already decided on. And you have to specify the same MQTT broker instead of "localhost" if you are connecting to a different broker from what you specified on this HTML control panel.

4) Publish a message

Let's try to send messages between the web browser and thr UNIX terminal each other, by the following ways.

UNIX to Web
Type the following command on your UNIX terminal.

("TOPIC" is the topic name you already decided on. And you have to specify the same MQTT broker instead of "localhost" if you are connecting to a different broker from what you specified on this HTML control panel.) You must be able to see the "Hello, world!" message in the "RECV" section.
Web to UNIX
Write the topic name you already decided on into the "topicname" field in the "SEND" section. And also, write the "Hello, world!" message into the message field under the "topicname." Then, push the "Publish" button. So, you must be able to see the same message on your UNIX terminal!