1
00:00:01,170 --> 00:00:10,020
In this lecture, I am going to demonstrate a few examples of clients connecting to the encoded mosquito.

2
00:00:10,800 --> 00:00:15,860
He's not running on the Raspberry Pi and subscribing and publishing to topics.

3
00:00:16,380 --> 00:00:19,800
To do that, I'm going to use first the command lines.

4
00:00:19,800 --> 00:00:21,590
I've got to command line sessions here.

5
00:00:21,870 --> 00:00:25,850
One is going to be my publisher and the other one is going to be the subscriber.

6
00:00:26,130 --> 00:00:31,310
So essentially I'll be sending messages from one command line terminal to the other.

7
00:00:31,740 --> 00:00:38,130
But I am also going to use my ebooks, which is a graphical utility that allows me to do the exact same

8
00:00:38,130 --> 00:00:43,130
thing, just using a nice user interface like this instead of the command line.

9
00:00:43,140 --> 00:00:48,660
So whichever one you're more comfortable with, you can go ahead and use is exactly the same as far

10
00:00:48,660 --> 00:00:51,000
as the inquisitive broker is concerned.

11
00:00:51,630 --> 00:01:00,150
If you want to use military books, then go to works with Web dot com and Quiddity Buckstone HTML and

12
00:01:00,150 --> 00:01:05,430
download the version for your operating system just started and I'm going to show you how to set it

13
00:01:05,430 --> 00:01:07,050
up in this example here.

14
00:01:07,320 --> 00:01:14,820
I've got one EMCDDA decline connected to my Raspberry Pi full and Quiddity broker and I'm to set up

15
00:01:14,820 --> 00:01:16,310
another one for my note.

16
00:01:16,320 --> 00:01:22,860
Read Raspberry Pi or I'm going to put this aside for now because first I want to show you how to use

17
00:01:23,040 --> 00:01:25,230
the MUSKETT a pub and Muskett a sub.

18
00:01:25,920 --> 00:01:30,150
Utilities that come with mosquito on the command line.

19
00:01:30,420 --> 00:01:31,670
So here's a documentation.

20
00:01:31,670 --> 00:01:39,230
You go to Muskett IT Origi and in the menu and the documentation there is must get a pub.

21
00:01:39,270 --> 00:01:44,310
This is the publisher and mosquito sub, which is the subscriber.

22
00:01:44,680 --> 00:01:47,620
You can see they're both very easy to use.

23
00:01:48,150 --> 00:01:57,840
Now let's say that I want to have a publisher that sends numbers and text to a topic on my note read

24
00:01:57,840 --> 00:01:58,950
and it broke up.

25
00:01:59,250 --> 00:02:03,450
And then down here I'm going to set up a subscriber.

26
00:02:03,450 --> 00:02:11,970
So whatever data I sent via the publisher will be shown by the subscriber or will be propagated by the

27
00:02:11,970 --> 00:02:14,550
broker to the subscriber to be more correct.

28
00:02:15,180 --> 00:02:21,960
So let's start with the subscriber first and then I'm going to send messages using the must get a pub

29
00:02:21,970 --> 00:02:22,580
utility.

30
00:02:23,040 --> 00:02:25,020
So let's go ahead and subscribe to a topic.

31
00:02:25,350 --> 00:02:30,840
So that is going to be done via mosquito sub for the subscriber.

32
00:02:32,310 --> 00:02:38,120
I'm going to use the this switch to give me verbose output, as you can see from the documentation here.

33
00:02:38,760 --> 00:02:40,710
Let's have a quick look at the.

34
00:02:43,110 --> 00:02:50,220
She was down here, they give their Bruce right, and then that he switched to subscribe to a specific

35
00:02:50,220 --> 00:02:56,850
topic, take exploration's for slash test is a topic that I want to subscribe to.

36
00:02:57,900 --> 00:02:59,360
All right, sir.

37
00:02:59,410 --> 00:03:07,230
You can see the utility is running and it's going to give me output as soon as a publisher sense something

38
00:03:07,230 --> 00:03:08,250
to this topic.

39
00:03:08,790 --> 00:03:15,660
So I'm going to copy this topic and then go up to the top command line terminal and use the publisher

40
00:03:15,870 --> 00:03:16,980
to publish something.

41
00:03:17,340 --> 00:03:21,390
So let's go for Mosquito Pub.

42
00:03:25,260 --> 00:03:32,190
And I just want to pass the test switch and the topic that I want to publish to and then with the M,

43
00:03:32,340 --> 00:03:38,250
which let's say a message, hello world.

44
00:03:40,710 --> 00:03:49,320
Like this and there's the message appearing down here, if you have a look at the documentation for

45
00:03:49,320 --> 00:03:54,930
the publisher, you'll see that it basically has a lot of options that are available.

46
00:03:54,940 --> 00:04:00,810
But as you can see in this example, you definitely need to include the the topic and then the message

47
00:04:00,810 --> 00:04:02,160
that you want to pass on.

48
00:04:02,490 --> 00:04:08,610
Later on, I'm going to show you how to configure the broker so that it requires authentication.

49
00:04:08,610 --> 00:04:14,880
And there will be passing the authentication username and password through the command line like this

50
00:04:14,880 --> 00:04:15,360
as well.

51
00:04:16,440 --> 00:04:20,190
The information that you can send through all the data is arbitrary.

52
00:04:20,190 --> 00:04:26,220
So like you can put a number, for example, and you will come through or you can have a comma delimited

53
00:04:26,220 --> 00:04:28,680
file such as one to three.

54
00:04:28,680 --> 00:04:29,640
Doesn't really matter.

55
00:04:29,970 --> 00:04:38,010
The muscular broke and its clients are totally agnostic in terms of the kind of data that you are sending

56
00:04:38,010 --> 00:04:38,440
through.

57
00:04:39,120 --> 00:04:45,420
So now that you've seen how this can be done in the comment line, I'm also going to show you how to

58
00:04:45,420 --> 00:04:48,090
do it using the client.

59
00:04:48,750 --> 00:04:51,450
So I'm going to create a new client.

60
00:04:51,570 --> 00:04:52,890
Just make this a little bigger.

61
00:04:54,490 --> 00:05:00,460
So I'm going to create a new client and I'm going to give it a name, Nood.

62
00:05:02,030 --> 00:05:06,500
Read the name is and does not need to be the same name as the name of the survivor.

63
00:05:06,530 --> 00:05:11,570
This is just something that sits within the environment of the kitty box client.

64
00:05:12,380 --> 00:05:20,420
This is the client I.D. the way that by default, this broker works is that every client needs to identify

65
00:05:20,420 --> 00:05:21,630
itself with a unique I.D..

66
00:05:21,630 --> 00:05:27,800
Speaking of the type something in here yourself or just let the client pick a totally random client.

67
00:05:27,820 --> 00:05:36,080
IP for the protocol would choose and quiddity over Tsipi and for the host, this is what is important

68
00:05:36,680 --> 00:05:46,340
to see node red dot local, which is the domain of the Raspberry Pi information on which my broker is

69
00:05:46,340 --> 00:05:48,070
running username and password.

70
00:05:48,080 --> 00:05:49,010
Leave them empty.

71
00:05:49,310 --> 00:05:49,970
So that's it.

72
00:05:49,970 --> 00:05:55,250
Let's click on Safe and you can see that the client is immediately connected.

73
00:05:55,580 --> 00:06:04,340
Now, the first thing that I do is since I've got a subscriber running down here, I'm going to create

74
00:06:04,340 --> 00:06:05,420
another publisher.

75
00:06:08,590 --> 00:06:17,290
And publish something like one, two, three to the same topic, and you can see that that appears right

76
00:06:17,290 --> 00:06:25,660
here, so that demonstrates that it's possible to have multiple publishers and multiple clients all

77
00:06:25,660 --> 00:06:33,200
connected to the same topic and under the opposite of take the same topic and subscribe to it.

78
00:06:33,220 --> 00:06:35,170
And the quality of service limit is zero.

79
00:06:35,380 --> 00:06:37,320
So now we've got another subscriber.

80
00:06:37,630 --> 00:06:41,080
I've got one subscriber here and another subscriber here.

81
00:06:41,530 --> 00:06:51,180
And I'll go to a publisher here and just add some more information to my message and send it through.

82
00:06:51,190 --> 00:07:00,640
And she can see, it appears to both subscribers or the broker forwards the new data to both subscribers,

83
00:07:01,510 --> 00:07:03,500
even within the maturity environment.

84
00:07:03,520 --> 00:07:08,290
If I published something else, like a bit of text.

85
00:07:10,800 --> 00:07:19,340
That message, this this piece of data will be propagated to any subscriber connected to the same topic,

86
00:07:19,830 --> 00:07:27,690
and this pretty much it with what you know now about the activity, Muskett, a broker, and the clients,

87
00:07:27,690 --> 00:07:34,080
both publishers and subscribers, you know, enough to be able to continue with this project.

88
00:07:34,560 --> 00:07:40,830
But since we are talking about mosquito, let's move on to the next election because I want to show

89
00:07:40,830 --> 00:07:48,540
you some interesting configuration options and also show you how to set a password and username for

90
00:07:48,540 --> 00:07:52,760
authentication to add a level of security to our application.
