OK, so this is probably going to be the most tricky section of them all, because we are dealing with
this nested state inside of a redock store and we have a lot of moving parts.
We have our client that needs to work just right.
And the state inside of the client needs to work just right.
And we also need to update and send messages from the server again.
So stick with me and I hope you will get through this together.
OK, so first, let's do a little cleanup, let's remove this joint event we have inside of our Servatius
file because we are not using this anymore.
We're using this we have an action with types instead.
So now this is deleted.
And we also should remove this server slash halo event because that was just to make sure our socket
IO middleware was working.
So now this is deleted.
Let's save to fail and then let's go inside the abcess file and delete some unused things again.
This time, let's delete the message event, because that was also just to test the socket IO middleware.
Let's delete that and then it's the latest dispatch of servers, László.
Now we need to go inside of the chest screen and we need to be able to set the you side here to something
unique that we actually have from the server or the socket IO server instead of just having a number
one here.
So let's go ahead and see how we can do that inside the server chairs file.
On this program, an event we're going to send back to the circuit that is connected and showing what
kind of user I.D. it has, so we will see circuit that imit with the action of a type that says, let's
call it self user and set the data to be the users.
The user object of this socket, it.
This way, we can know what kind of some good ideas do I have as a client?
Then inside the fire, we need to make a event that is listening for this type.
So inside here, we will say case, self user.
And will say return dot, dot, dot state, which is self user being the action that data.
OK, now let's try and see if we can see this data when we get it.
So inside here, let's type in, I guess.
And let's take a look inside of our terminal.
OK, so our terminal is getting pretty, uh, pretty packed right now, so let's try and remove some
console locks we have inside of defriended screen.
Also inside here, we have two consulates, one for users online.
Let's remove that.
And let's remove this one for item inside the render item function.
OK, just a little clean up, let's close to file now.
And now let's try and look inside of the console, a little tip for you guys.
I would recommend that you open up to develop a menu and use remote debarking instead.
Or if you're on Android, it's also just Depok chest remotely.
It's going to open up a browser tab where you can see a better kind of console log of what's going on.
So now I try and trying to chat with the username Iooss.
Let's see if the state gets updated.
I can see it's now updated with the self user property where the user name is Iooss, and we have this
unique user name or use I.D..
Now let's go inside of our chat screen and import the use selector.
And in sight here, let's make sure to get this self user property that we want to use.
So you selecter.
State, state, that self user.
And in here, let's set the I.D. to be self user, the user I.D..
OK.
That's all we need to do for now.
Now we have the user IDs set to what the user is actually inside of gifted to chat.