In this lecture, I am going to demonstrate a few examples of clients connecting to the encoded mosquito.
He's not running on the Raspberry Pi and subscribing and publishing to topics.
To do that, I'm going to use first the command lines.
I've got to command line sessions here.
One is going to be my publisher and the other one is going to be the subscriber.
So essentially I'll be sending messages from one command line terminal to the other.
But I am also going to use my ebooks, which is a graphical utility that allows me to do the exact same
thing, just using a nice user interface like this instead of the command line.
So whichever one you're more comfortable with, you can go ahead and use is exactly the same as far
as the inquisitive broker is concerned.
If you want to use military books, then go to works with Web dot com and Quiddity Buckstone HTML and
download the version for your operating system just started and I'm going to show you how to set it
up in this example here.
I've got one EMCDDA decline connected to my Raspberry Pi full and Quiddity broker and I'm to set up
another one for my note.
Read Raspberry Pi or I'm going to put this aside for now because first I want to show you how to use
the MUSKETT a pub and Muskett a sub.
Utilities that come with mosquito on the command line.
So here's a documentation.
You go to Muskett IT Origi and in the menu and the documentation there is must get a pub.
This is the publisher and mosquito sub, which is the subscriber.
You can see they're both very easy to use.
Now let's say that I want to have a publisher that sends numbers and text to a topic on my note read
and it broke up.
And then down here I'm going to set up a subscriber.
So whatever data I sent via the publisher will be shown by the subscriber or will be propagated by the
broker to the subscriber to be more correct.
So let's start with the subscriber first and then I'm going to send messages using the must get a pub
utility.
So let's go ahead and subscribe to a topic.
So that is going to be done via mosquito sub for the subscriber.
I'm going to use the this switch to give me verbose output, as you can see from the documentation here.
Let's have a quick look at the.
She was down here, they give their Bruce right, and then that he switched to subscribe to a specific
topic, take exploration's for slash test is a topic that I want to subscribe to.
All right, sir.
You can see the utility is running and it's going to give me output as soon as a publisher sense something
to this topic.
So I'm going to copy this topic and then go up to the top command line terminal and use the publisher
to publish something.
So let's go for Mosquito Pub.
And I just want to pass the test switch and the topic that I want to publish to and then with the M,
which let's say a message, hello world.
Like this and there's the message appearing down here, if you have a look at the documentation for
the publisher, you'll see that it basically has a lot of options that are available.
But as you can see in this example, you definitely need to include the the topic and then the message
that you want to pass on.
Later on, I'm going to show you how to configure the broker so that it requires authentication.
And there will be passing the authentication username and password through the command line like this
as well.
The information that you can send through all the data is arbitrary.
So like you can put a number, for example, and you will come through or you can have a comma delimited
file such as one to three.
Doesn't really matter.
The muscular broke and its clients are totally agnostic in terms of the kind of data that you are sending
through.
So now that you've seen how this can be done in the comment line, I'm also going to show you how to
do it using the client.
So I'm going to create a new client.
Just make this a little bigger.
So I'm going to create a new client and I'm going to give it a name, Nood.
Read the name is and does not need to be the same name as the name of the survivor.
This is just something that sits within the environment of the kitty box client.
This is the client I.D. the way that by default, this broker works is that every client needs to identify
itself with a unique I.D..
Speaking of the type something in here yourself or just let the client pick a totally random client.
IP for the protocol would choose and quiddity over Tsipi and for the host, this is what is important
to see node red dot local, which is the domain of the Raspberry Pi information on which my broker is
running username and password.
Leave them empty.
So that's it.
Let's click on Safe and you can see that the client is immediately connected.
Now, the first thing that I do is since I've got a subscriber running down here, I'm going to create
another publisher.
And publish something like one, two, three to the same topic, and you can see that that appears right
here, so that demonstrates that it's possible to have multiple publishers and multiple clients all
connected to the same topic and under the opposite of take the same topic and subscribe to it.
And the quality of service limit is zero.
So now we've got another subscriber.
I've got one subscriber here and another subscriber here.
And I'll go to a publisher here and just add some more information to my message and send it through.
And she can see, it appears to both subscribers or the broker forwards the new data to both subscribers,
even within the maturity environment.
If I published something else, like a bit of text.
That message, this this piece of data will be propagated to any subscriber connected to the same topic,
and this pretty much it with what you know now about the activity, Muskett, a broker, and the clients,
both publishers and subscribers, you know, enough to be able to continue with this project.
But since we are talking about mosquito, let's move on to the next election because I want to show
you some interesting configuration options and also show you how to set a password and username for
authentication to add a level of security to our application.