Hello and welcome to the golems programming language course.
In the previous session, they could implement such a player.
Now it's time to set up the server layer.
The task of this layer is to decide and manage requests that are sent from the client to the server.
So go to Package Expeller and go to Web Socket Project and create the folder name like server layer.
And incite it, create a file like server that go server that could
set the package name, package me in this file.
We have to do two things related to setting off the server.
That is, we created an issue to the server and introduce it as a server of the VIPs circuit type and
send the desired handler to it.
So define a main method.
Now you create a server by calling the server extract from the 8TB package and initialize its properties.
So define a variable like server column equals history, Typekit dot server
and initialize tool property, first address and Second Handler Address
Address optionally specifies the TCP IP address before the server to listen on.
In this case, we want to run server on localhost by port number 85.
So we write double quotation mark a hundred and twenty seven dots 0.0 0.1 as localhost IP calling 1885
as port number.
And Handler
Handler to invoke default serve marks.
So for these handler, we need to create a mock server.
So go top of this block and define a server marks.
From the HDTV package, Connie Nielsen mocks function, this function and looks and returns and new
survey marks.
So first, define a variable like mock server mocks, server calling equals and invoking new server
function lost from 8TB Package 82, don't you, sir?
Mark's now calling handle function from mock server handle function registers the handler for the given
patter, so go to the next line.
Mark's server dot handle
dysfunction accept two arguments.
First, a pattern that we said root for it e.g. localhost year double quotation mark insert as much
as localhost and second a handler.
In this case, the calling handler function from reps package for it.
The right whip cards
dot handler function.
Handler is a simple interface to events to get broader client, it accepts a connection, this pointer,
which she also created, these are a function for it.
So the right fine.
And said the connection as pointer of VIPs get connection.
Now, we said they created Mock Server as the venue for the handle property on the server.
So we write.
Handler Colin Marx said We created our server and made the configurations inside it.
Now it's time to run it to do this record release and then serve function inside the server.
This function listens on the TCP network address and then comes serve to handle requests on incoming
connections.
He's an announcer, always returns in non-media role.
So first, define a variable like error.
A roll call in he calls from server
calling lesen to serve function, Lisa and server function.
Now check error status
like Dot Fattore and or Dot L
reformat the code and save the project in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.