Hello everyone. Welcome back to the video number 8.2. And
in this video, we're going to set up
device server.
Regarding the call which will respond to the specific request.
But before moving to the setup, possibly we
need to know about the core protocol. It's specification.
Actually Kobe is maintained by
ietf internet engineering task force,
and there are a lot of rfcs and on the
Wikipedia have a
complete page which will provide you
all the detail regarding message format and its
versions tokens options.
And here are the implementations in different
languages. For example, this is a dirt client
for the cope and there
is example of Python 3
aiocop client plus server
both and we're going to use
nordjs nordcap this
version which is available on the GitHub and
Is the GitHub repository I already downloaded all the
stuff which is available here.
After downloading you guys need to set up
install and update all the stuff using npm bar
before moving on you need to install a node.js on your machine
after that. You need to open up
your terminal and you need
to move your terminal directory to
the
to the specific directory where you have all the your files
most probably you guys you can
download and move it to the C and here you can
extract all the stuff and install npm install Corp and
before moving on you can use npm update
and all the stuff so you can get
all the
independencies for installation. So after
installation here is the terminal where
we have our examples. This is
the complete folder where we have a good distribution
Library module snore modules and
here are the examples. We have a different type of examples here,
but here is an example device server
that actually I have
seen on internet and then I modified it and
use this is a very good example. It's like you
need to set up a device and This
Server will act as a device where
We have a three sensors air quality index
temperature and the humidity one hour anybody
any device request the data from that
server. It will send the data. So let's get started with
that firstly. We need to Define.
The cope required that Library. Okay, and here
is the function which will return the value. We are
providing minimum maximum range and it will return us the random
number. Actually, we are not using the sensors. We're just providing the
dummy values. That's why we have created the random
integer method here to send and four
by default Port is five six eight three for the Cove server
and here we are creating the create Cove server
function request and go device
got a request from that it will display a message
whenever it will receive the request from
And in order for the data, okay, and then later
on it will verify that what's the
URL actually in the previous video. I
told you that it works like the HTTP URLs.
So for example, if a client is requesting
here, it will request your call.
Localhost / aqy. Sorry, this
is the
local
this is the localhost. Okay, and
it will automatically fetch that part and check which
part has been requested here and according
to that it will provide you the
output. Okay. So here we have our random input
method. We provided the range from 0 to
1000 and it's providing us some brand name integer for
that and here is a temperature case and the humidity case
and after that it will say that
cop server is
started at Port number five six eight three and this is
the method display output that we are
using to
send the output to the
Client or any other machine which
is requesting the data. Okay. So now we
need to open up in the terminal to
execute it to Y server.
Open an integrated terminal.
and node device
server
Sorry.
Now the cops server has been started at Port number five six eight
three in the next video. We are going to create a
program which will
request the data from that server to go. See you
in the next video. Have a good day. Bye.