Académique Documents
Professionnel Documents
Culture Documents
Internet of Things
SUMMER SCHOOL
Web server
HTTP
Gadgets
IoT Webserver
Outline Web templates
Web services
Web socket
Questions
2
Web server
3
What is a web server
Software that implements HTTP/HTTPS
Mainframes
Computers
Gadgets
4
Gadgets?!
5
What HTTP?
Widely used
Easy to implement
Text based
HTML
◦ Simple and flexible UI
◦ JavaScript runs in almost any browser
◦ Replace displays
6
UI
Gadgets prefer HTML UI Gadgets are using less displays
Accessible from the tablet Expensive
Wireless “display” Fixed
Web language Special software
7
HTTP
8
HTTP
9
HTTP
Request Response
◦ Headers ◦ Status
◦ Method ◦ Headers
◦ URL ◦ Data
◦ Query String
◦ Upload body
10
Query
http://address[:port]URL?querystring
http://wyliodrin.cs.pub.ro/projects?show=true
Address?
Port?
URL?
querystring?
11
Query
http://address[:port]URL?querystring
http://wyliodrin.cs.pub.ro/projects?show=true
Address? wyliodrin.cs.pub.ro
Port? 80
URL? /projects
querystring? show=true
12
Methods
GET
◦ Request objects without sending data
POST
◦ Modify objects with data that you are sending
PUT
◦ Create new objects with data that your are sending
DELETE
◦ Delete objects without sending data
13
HTTP
14
Gadgets
15
Webserver for the gadgets
16
Web
Web request
◦ Starts a webserver
◦ Sets up static folder
◦ Stores
◦ Html
◦ Javascript
◦ Css
http://address:port/static/index.html
17
Web
Web request
◦ Route
◦ Method
◦ Port
Message
{
payload: query string / upload data
req: request
res: response
next:
}
18
Web response
Web response
◦ Input from a web request
◦ Sends the payload
◦ Redirect
http://address:port/ redirects to
http://address:port/static/index.html
19
Run the server
Get the IP of the board
◦ Shell
◦ ifconfig
20
IoT Server
21
IoT Server
Server with public IP address
A gadget without pin access
Good for web server
◦ Web pages
◦ API
22
IoT Server
23
Web templates
24
Web template
Web template
◦ Loads a templates
◦ Fills it with variables
◦ From value
◦ From payload
◦ Sends it
25
Web template
• Values are available
• Payload variables are available
26
Web template
Value is refreshed only on a page reload
27
Web service
28
Web service is API
Expose functions for apps
◦ Mobile Applications
◦ Refresh the value without reloading the page
◦ Use multiple UI
29
Web response
Web response
◦ Input from a web request
◦ Sends the payload
◦ Redirect
30
Web response
/sensor returns
{
“sensor”: “0”
}
31
JQuery API
32
Web socket
33
Websocket
Allows asynchronous communication with the server
◦ Like a socket
◦ Uses HTTP or HTTPS
◦ Problems with proxies
Socket.IO
◦ Has a solution with HTTP or HTTPS if the websocket is unavailable
34
Websocket
35
Web starter app
Streams
Web starter app
Angular JS
36
Angular JS
static/web.html
37
Javascript
38
Questions?
39