WEBVTT

00:00.240 --> 00:01.400
Hi everyone.

00:01.400 --> 00:03.080
Let's continue with a friend.

00:03.120 --> 00:04.000
Gateway.

00:04.680 --> 00:09.040
Okay, right now we already got the save friend.

00:09.320 --> 00:14.920
We need to convert it into the zero again with exactly the same structure.

00:15.560 --> 00:21.360
Okay, so for that reason, this guy, if you remember in here, we already got the populate with the

00:21.360 --> 00:22.680
sender okay.

00:23.000 --> 00:26.600
And we also populate with the receivers right.

00:28.880 --> 00:40.720
So right right now we need to populate that also right after we already got the save friend we can create

00:40.800 --> 00:43.720
the method for get that.

00:43.760 --> 00:45.720
Let me create that as in.

00:52.800 --> 00:54.000
Find one.

00:58.680 --> 01:01.600
And right here I will call friend equal.

01:01.640 --> 01:11.030
Why not friend request model not file by right here and make sure we populate us.

01:13.230 --> 01:18.110
With listed and we need to give no frame.

01:19.510 --> 01:20.150
I will.

01:23.070 --> 01:27.830
Throw new not file etc. right?

01:27.870 --> 01:28.550
No file.

01:30.350 --> 01:31.430
Friend request.

01:31.470 --> 01:32.110
No file.

01:32.470 --> 01:32.990
Okay.

01:34.110 --> 01:35.830
And return of right over here.

01:41.030 --> 01:45.510
And now, after we already have a frame, we need to.

01:48.550 --> 01:50.750
Write, friend.

01:52.790 --> 01:53.590
Request.

01:53.630 --> 01:53.910
Okay.

01:53.910 --> 01:56.750
That's what this friend request.

01:56.750 --> 01:57.190
Right.

01:58.590 --> 02:02.820
Equal away this dot not.

02:03.300 --> 02:07.260
Buy one and boost the idea over here.

02:11.140 --> 02:17.980
Alright, after we already got the friend request we need to send, right?

02:23.180 --> 02:27.420
Now we need to inject the friend gateway.

02:43.860 --> 02:46.820
And now I will call the handles.

02:51.420 --> 02:54.220
Send friend request.

02:54.260 --> 02:54.780
Okay.

02:55.140 --> 02:55.780
Let us.

02:56.420 --> 02:57.260
And, uh.

02:57.460 --> 02:57.700
What?

02:57.700 --> 02:58.540
We need both.

02:59.260 --> 03:01.540
We need to convert this thing into the digital.

03:01.580 --> 03:02.060
Right.

03:17.130 --> 03:20.610
We already created utility methods, right?

03:34.010 --> 03:35.690
We released the water over here.

03:36.810 --> 03:38.370
Let me create this method.

03:55.090 --> 04:00.290
Here you say right here we got the response blackboard over here.

04:03.890 --> 04:05.160
And what we need to ago.

04:06.600 --> 04:13.520
We need to emit events with the same friend request.

04:14.680 --> 04:15.960
Put the data over here.

04:16.400 --> 04:20.160
Okay, now you can take this one or not.

04:21.600 --> 04:25.280
Firstly, I will console.log the data over here.

04:29.320 --> 04:30.720
And open the terminal.

04:35.880 --> 04:45.240
Now from I to VI, it means from the same friend to the from us.

04:45.280 --> 04:45.800
Okay.

04:46.720 --> 04:51.280
It means to send over here will be zone and receiver will be Thomas.

04:51.280 --> 04:51.680
Right?

04:53.040 --> 05:01.040
So, uh, it's back when I logged in with the Thomas account, I will see the sender name will be John.

05:01.080 --> 05:09.630
Okay, so for this case I will click on friend request and I will remove the result.

05:09.630 --> 05:10.470
Creators.

05:12.190 --> 05:13.030
Let me reboot us.

05:13.070 --> 05:13.510
Okay.

05:14.030 --> 05:15.350
Remove the bandage over here.

05:18.470 --> 05:20.750
And open again.

05:21.670 --> 05:24.230
Click on send friend request.

05:24.270 --> 05:29.390
Make sure in this case we should login with the.

05:31.550 --> 05:33.270
Zone account okay.

05:33.310 --> 05:43.950
Zone will send friend to the right by this thing and move over here with the friend.

05:44.110 --> 05:47.110
Make sure you copy the ID from the Thomas.

05:56.310 --> 05:56.950
Over here.

05:56.990 --> 05:57.470
Okay.

05:57.790 --> 05:59.070
And send that.

05:59.590 --> 06:01.830
Now let's take a look at the data.

06:02.270 --> 06:04.070
We already got the sender name.

06:04.070 --> 06:04.630
Which zone?

06:04.670 --> 06:11.660
It means we already So secondly, send the event right.

06:12.980 --> 06:21.060
You will say right here the sender should be the commerce and it's already work, but it's not enough.

06:22.420 --> 06:28.460
You can say in here this dot server is exactly the same with this.

06:28.700 --> 06:30.620
Sorry with IO dot image.

06:30.620 --> 06:31.060
Right.

06:32.060 --> 06:43.060
It means with IO right here we actually send this message to on the client has connect to the server

06:44.020 --> 06:44.540
right.

06:47.140 --> 06:50.180
And you can taste good or not.

06:50.580 --> 06:53.060
Well this not good at all.

06:53.820 --> 06:55.140
We don't need to send.

06:57.500 --> 07:03.220
The event into own client has to connect to the server.

07:03.820 --> 07:06.340
This is not good at all for a reason.

07:06.340 --> 07:11.170
In this case we should use Deals are so okay.

07:11.610 --> 07:15.810
We need to use a tool and we need to move the receiver.

07:17.610 --> 07:17.970
Okay.

07:17.970 --> 07:20.050
We need to send from sorry.

07:20.810 --> 07:22.890
We need to send a.

07:25.290 --> 07:28.890
Width string and both receiver error.

07:28.930 --> 07:35.850
Here let me explain to you what exactly that mean is here we should mark the receiver array.

07:36.250 --> 07:36.730
Right.

07:37.570 --> 07:42.010
So you can put receiver array directly from parameter over here.

07:44.450 --> 07:44.970
Okay.

07:45.570 --> 07:52.250
What actually does this mean right now I will explain for you.

07:52.810 --> 07:55.050
Don't worry about the receiver idea right now.

07:55.290 --> 07:58.690
But before that let me create one more thing called subscribe.

07:59.810 --> 08:00.810
Subscribe.

08:01.730 --> 08:02.970
This will be.

08:07.170 --> 08:09.710
Uh, Let me say.

08:09.710 --> 08:10.550
What is your name?

08:11.910 --> 08:12.550
This is our.

08:15.390 --> 08:15.830
Room.

08:17.750 --> 08:18.310
Okay.

08:20.870 --> 08:21.270
Go on.

08:23.710 --> 08:24.270
Okay.

08:24.310 --> 08:25.550
My real name.

08:25.590 --> 08:26.190
Let us.

08:27.270 --> 08:30.510
And we need to create a surprise message.

08:30.990 --> 08:34.190
Okay, let me check the documentation to see.

08:34.670 --> 08:35.110
Don't worry.

08:35.110 --> 08:38.630
I'll explain why I do like that.

08:43.750 --> 08:45.350
I don't remember to call.

08:49.630 --> 08:50.790
Also, get over here.

08:51.430 --> 08:54.430
Get Y and copy the message.

08:55.390 --> 08:58.190
Right here we have something like here.

09:01.390 --> 09:03.310
Okay, let me move that over here.

09:03.750 --> 09:09.430
We have message body come from the client, right?

09:10.940 --> 09:15.180
And we have one more thing we call a client.

09:16.540 --> 09:17.700
So let's get over here.

09:17.740 --> 09:18.100
Okay.

09:18.380 --> 09:22.300
So let me ask you last.

09:31.380 --> 09:31.820
Okay.

09:31.820 --> 09:33.500
Let me show you what what I mean.

09:35.020 --> 09:36.700
Are we above the socket over here?

09:42.860 --> 09:52.620
And from the socket, what we need to do, we need to use client browser window.

09:53.060 --> 09:56.460
Right here will be a user ID.

09:58.460 --> 09:59.900
What is user ID over here?

10:07.420 --> 10:10.460
So let me explain for you why I do.

10:11.730 --> 10:21.010
That's why I create a subscribe message and why I create the same friend request and why to receive

10:21.010 --> 10:21.570
value.

10:22.010 --> 10:23.250
What exactly does that mean?

10:24.010 --> 10:28.650
Well, firstly, let's see how we can join a room.

10:29.370 --> 10:35.930
Well, for example, in order for a plugin on the front end.

10:36.370 --> 10:40.050
Okay, we log in with the zone account.

10:40.890 --> 10:41.410
Okay.

10:42.530 --> 10:50.730
It means we need to write the socket for the one like this when the connect happen.

10:54.570 --> 10:58.970
What we need to do when we need to join.

10:59.450 --> 11:03.570
We need to send the event right here to zero.

11:03.770 --> 11:04.290
Okay.

11:04.330 --> 11:05.170
It mean right here.

11:05.170 --> 11:09.930
We should write something like okay now.

11:14.120 --> 11:14.400
Ah!

11:15.520 --> 11:16.800
Sorry, doc.

11:18.400 --> 11:18.920
Emmett.

11:18.960 --> 11:23.720
We need to emit an event with a zero over here with the user id.

11:23.960 --> 11:24.280
Okay.

11:24.320 --> 11:30.520
With a user ID current user id where the current user ID comes from.

11:31.040 --> 11:33.160
Maybe it comes from the redux.

11:33.200 --> 11:33.680
Okay.

11:34.120 --> 11:38.400
We took a look at the ID from Redux or the local storage.

11:38.760 --> 11:40.560
I don't care about that right now.

11:41.120 --> 11:41.600
Okay.

11:42.640 --> 11:44.280
Important part right here.

11:45.800 --> 11:52.640
When we connect we need to immediately Xyrem with exactly the same current user.

11:53.040 --> 11:54.400
Why we need to do that.

11:54.840 --> 11:58.480
Well, right now, if I logged in with own account.

11:58.800 --> 11:59.320
Okay.

11:59.600 --> 12:02.440
It means when I logged in without account.

12:02.600 --> 12:16.110
We immediately zero inside the zone we use on the ID irony of this zone right here, for example, is

12:16.110 --> 12:17.470
only here half a day.

12:18.270 --> 12:21.550
One, it means we will light into the room.

12:21.590 --> 12:22.110
One.

12:22.310 --> 12:22.790
Right?

12:23.150 --> 12:32.430
And in later, for example, if another client connects to the Mastercard, we have to determine whether

12:33.030 --> 12:35.830
to allow the room to.

12:35.870 --> 12:36.350
Right.

12:37.990 --> 12:49.910
So with this guy, every time we connect into the WebSocket server, we immediately join into that room.

12:51.110 --> 12:58.750
And since we already joined that room, it means right now let's think about what is the receiver.

12:59.150 --> 13:04.950
The receiver here will be the Thomas right from the John I want to send.

13:05.790 --> 13:07.310
Only for Thomas.

13:07.350 --> 13:07.710
Right.

13:07.750 --> 13:09.830
I want to send from John to Thomas.

13:09.870 --> 13:13.950
It means the receiver ID right here will be the ID of Thomas.

13:13.950 --> 13:14.540
us, right?

13:14.780 --> 13:22.300
So whatever is on your list here, the server, it only sends the data into the format.

13:22.340 --> 13:24.300
This will be clearly autonomous.

13:24.300 --> 13:29.620
Right from the zone we send a message to the format.

13:29.660 --> 13:29.980
Okay.

13:29.980 --> 13:37.860
It means from the server we will send into the room of the Thomas receiver.

13:37.860 --> 13:38.220
Allegro.

13:38.260 --> 13:38.540
Here.

13:38.580 --> 13:42.140
Remember the receiver Allegro here is a Thomas.

13:42.500 --> 13:43.060
Okay.

13:43.740 --> 13:52.260
So for that reason the receiver Allegro here will be will become ID Thomas.

13:52.300 --> 13:54.100
We already saw before us.

13:54.140 --> 13:54.660
Right.

13:55.100 --> 14:00.340
So in order to use the two method, we should join us before.

14:01.060 --> 14:01.500
Okay.

14:01.540 --> 14:04.860
And in order to resolve that, we should join from the client.

14:05.140 --> 14:05.500
Okay.

14:05.540 --> 14:11.060
For that reason, we will create a subscribe message with this account.

14:11.180 --> 14:11.420
Sorry.

14:11.460 --> 14:12.940
With this event name.

14:13.540 --> 14:15.340
I hope you're very clear right now.

14:15.410 --> 14:15.930
Right.

14:16.410 --> 14:20.450
Would you say with the best body will be the user ID roughly over here?

14:20.850 --> 14:21.330
Okay.

14:22.210 --> 14:26.370
And once you get it, will join into the room.

14:26.810 --> 14:27.290
Okay.

14:27.330 --> 14:30.610
For example, right here will be the zone.

14:30.770 --> 14:31.130
Right.

14:31.170 --> 14:31.850
It means over here.

14:31.850 --> 14:32.610
We already.

14:34.930 --> 14:35.490
Zone.

14:35.530 --> 14:36.170
Over here.

14:36.210 --> 14:36.530
Okay.

14:36.570 --> 14:38.850
If we log in with Tomas, it means right here.

14:38.850 --> 14:40.930
We will use Tomas.

14:40.970 --> 14:41.450
Okay.

14:42.250 --> 14:50.290
So with this team, we will send only for the receiver will be the Tomas right now.

14:51.770 --> 14:52.130
Okay.

14:52.130 --> 14:54.050
I hope you are very clear about that.

14:54.890 --> 15:01.010
And this will be good for performance perspective and without message code.

15:01.050 --> 15:01.530
Okay.

15:04.130 --> 15:07.450
So I hope you understand right now.

15:07.450 --> 15:09.250
And it's for the job.

15:13.490 --> 15:15.330
So I will see you in the next one.
