Internet = network
Web = information space
Internet = network
Web = information space
Reference: https://www.w3.org/TR/webarch/
Separation of:
The World Wide Web (WWW, or simply Web) is an information space in which the items of interest, referred to as resources, are identified by global identifiers called Uniform Resource Identifiers (URI).
Architecture of the World Wide Web, volume 1
URL: Universal Resource Locator (RFC 1738)
URN: Universal Resource Name
URI: Universal Resource Identifier
URI = URL ∪ URN
URI (RFC 3986, 2005) - IRI (RFC 3987, 2004)
?
URI (RFC 3986, 2005) - IRI (RFC 3987, 2004)
IRI: Internationalized Resource Identifiers
In order to communicate internally, a community agrees (to a reasonable extent) on a set of terms and their meanings. […] the Web makes use of a single global identification system: the [IRI]. [IRIs] are a cornerstone of Web architecture, providing identification that is common across the Web. […]
https://www.w3.org/TR/webarch/#identification
Some definitions:
Communication between agents over a network about resources involves [IRIs], messages, and data. The Web’s protocols (including HTTP, FTP, SOAP, NNTP, and SMTP) are based on the exchange of messages.
https://www.w3.org/TR/webarch/#interaction
A message may include data as well as metadata about a resource, the message data, and the message itself. A message may even include metadata about the message metadata
Some definitions:
Dereference a URI: Action aiming at accessing the identified resource
the semantics of accessing is defined by the interaction protocol
Representations should be octet streams typed by internet media types
text/plain, application/xml, application/pdf, video/3gpp, …
Media-type vs Content-type?
Request/Reponses vs Publish/Subscribe interaction paradigms
The HTTP for constrained devices: "binarification and UDP-ization of HTTP" …
Constrained Application Protocol (CoAP, RFC 7252, June 2014)
The HTTP for constrained devices: "binarification of HTTP" …
Constrained Application Protocol (CoAP, RFC 7252)
. 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The HTTP for constrained devices: "binarification of HTTP" …
Code = Binary code for verbs and response codes: 3 bits '.' 5 bits
0.X = request
Initial entries in the CoAP Method Codes sub-registry are as follows:
+------+--------+-----------+
| Code | Name | Reference |
+------+--------+-----------+
| 0.01 | GET | [RFC7252] |
| 0.02 | POST | [RFC7252] |
| 0.03 | PUT | [RFC7252] |
| 0.04 | DELETE | [RFC7252] |
+------+--------+-----------+
See https://www.iana.org/assignments/core-parameters/ for the current list of entries
The HTTP for constrained devices: "binarification of HTTP" …
Code = Binary code for verbs and response codes: 3 bits '.' 5 bits
1.X - 5.X = response codes similar to HTTP
Initial entries in the CoAP Response Codes sub-registry are as follows:
+------+------------------------------+-----------+
| Code | Description | Reference |
+------+------------------------------+-----------+
| 2.01 | Created | [RFC7252] |
| 2.02 | Deleted | [RFC7252] |
| 2.03 | Valid | [RFC7252] |
| 2.04 | Changed | [RFC7252] |
| 2.05 | Content | [RFC7252] |
| 4.00 | Bad Request | [RFC7252] |
| 4.01 | Unauthorized | [RFC7252] |
| 4.02 | Bad Option | [RFC7252] |
| 4.03 | Forbidden | [RFC7252] |
| 4.04 | Not Found | [RFC7252] |
| 4.05 | Method Not Allowed | [RFC7252] |
| 4.06 | Not Acceptable | [RFC7252] |
| 4.12 | Precondition Failed | [RFC7252] |
| 4.13 | Request Entity Too Large | [RFC7252] |
| 4.15 | Unsupported Content-Format | [RFC7252] |
| 5.00 | Internal Server Error | [RFC7252] |
| 5.01 | Not Implemented | [RFC7252] |
| 5.02 | Bad Gateway | [RFC7252] |
| 5.03 | Service Unavailable | [RFC7252] |
| 5.04 | Gateway Timeout | [RFC7252] |
| 5.05 | Proxying Not Supported | [RFC7252] |
+------+------------------------------+-----------+
See https://www.iana.org/assignments/core-parameters/ for the current list of entries
The HTTP for constrained devices: "UDP-ization" of HTTP …
Constrained Application Protocol (CoAP, RFC 7252)
. 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The HTTP for constrained devices: "UDP-ization" of HTTP …
Constrained Application Protocol (CoAP, RFC 7252)
Reliable vs Unreliable messages transmission
CON Confirmable, NON Non-confirmable, ACK acknowledgement
. Client Server Client Server
| | | |
| CON [0x7d34] | | NON [0x01a0] | <- [Message ID]
+----------------->| +----------------->|
| | | |
| ACK [0x7d34] |
|<-----------------+
| |
The HTTP for constrained devices: "UDP-ization" of HTTP …
Constrained Application Protocol (CoAP, RFC 7252)
. Client Server Client Server
| | | |
| CON [0xbc90] | | CON [0xbc91] | <- [Message ID]
| GET /temperature | | GET /temperature |
| (Token 0x71) | | (Token 0x72) | <- (Token)
+----------------->| +----------------->|
| | | |
| ACK [0xbc90] | | ACK [0xbc91] |
| 2.05 Content | | 4.04 Not Found |
| (Token 0x71) | | (Token 0x72) |
| "22.5 C" | | "Not found" |
|<-----------------+ |<-----------------+
| | | |
The HTTP for constrained devices: "UDP-ization" of HTTP …
Constrained Application Protocol (CoAP, RFC 7252)
Reliable vs Unreliable messages transmission
. Client Server
| |
| CON [0x7a10] | <- [Message ID]
| GET /temperature |
| (Token 0x73) | <- (Token)
+----------------->|
| |
| ACK [0x7a10] | <- [same Message ID]
|<-----------------+
| |
... Time Passes ...
| |
| CON [0x23bb] | <- [different Message ID]
| 2.05 Content |
| (Token 0x73) | <- (same Token)
| "22.5 C" |
|<-----------------+
| |
| ACK [0x23bb] |
+----------------->|
| |
The HTTP for constrained devices: "binarification of HTTP" …
Options: critical (2n+1) vs elective (2n) + more subtelties …
Initial entries in the CoAP Option Numbers sub-registry are as follows:
+--------+------------------+-----------+
| Number | Name | Reference |
+--------+------------------+-----------+
| 0 | (Reserved) | [RFC7252] |
| 1 | If-Match | [RFC7252] |
| 3 | Uri-Host | [RFC7252] |
| 4 | ETag | [RFC7252] |
| 5 | If-None-Match | [RFC7252] |
| 7 | Uri-Port | [RFC7252] |
| 8 | Location-Path | [RFC7252] |
| 11 | Uri-Path | [RFC7252] |
| 12 | Content-Format | [RFC7252] |
| 14 | Max-Age | [RFC7252] |
| 15 | Uri-Query | [RFC7252] |
| 17 | Accept | [RFC7252] |
| 20 | Location-Query | [RFC7252] |
| 35 | Proxy-Uri | [RFC7252] |
| 39 | Proxy-Scheme | [RFC7252] |
| 60 | Size1 | [RFC7252] |
| 128 | (Reserved) | [RFC7252] |
| 132 | (Reserved) | [RFC7252] |
| 136 | (Reserved) | [RFC7252] |
| 140 | (Reserved) | [RFC7252] |
+--------+------------------+-----------+
The HTTP for constrained devices: "binarification of HTTP" …
Content-Format: also binary
Initial entries in this sub-registry are as follows:
+--------------------------+----------+----+------------------------+
| Media type | Encoding | ID | Reference |
+--------------------------+----------+----+------------------------+
| text/plain; | - | 0 | [RFC2046] [RFC3676] |
| charset=utf-8 | | | [RFC5147] |
| application/link-format | - | 40 | [RFC6690] |
| application/xml | - | 41 | [RFC3023] |
| application/octet-stream | - | 42 | [RFC2045] [RFC2046] |
| application/exi | - | 47 | [REC-exi-20140211] |
| application/json | - | 50 | [RFC7159] |
+--------------------------+----------+----+------------------------+
The HTTP for constrained devices: "binarification of HTTP" …
We will come back to some of them …
Request/Reponses vs Publish/Subscribe interaction paradigms
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Over TCP/IP
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Control Packet type (4 bits)
Examples:
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Clients publish at Topic Names
UTF-8 encoded list of tokens separated by '/' (possibly empty or containing ' ')
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Clients subscribe to Topic Filters
Topic Names with wildcards
room/+/temperature/17 is valid, room/1+/temperature/17 is not valid
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Quality of Service (QoS):
QoS 0: At most once delivery
QoS 1: At least once delivery
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Quality of Service (QoS):
QoS 2: Exactly once delivery
Message Queue Telemetry Transport Protocol (MQTT, Oasis Standard)
Since v5.0 (07 March 2019), PUBLISH messages have an option Content Type.
Response: NO. Resources are not identified by URIs
REST: Representational State Transfer
Loosely coupled services that can be easily reused and use
Application programming interface (API) to interact with Things
REST: Representational State Transfer
Loosely coupled services that can be easily reused and use
URIs to identify resources such as:
REST: Representational State Transfer
Create Read Update Delete (CRUD) operations
0.01 GET /sensor/14/temperature : Read temperature value of sensor 14
0.02 POST /sensor : Create new temperature sensor
0.03 PUT /heater/14 : Update the status of heater 14
0.04 DELETE /sensor/14 : Delete resource sensor 14
REST: Representational State Transfer
Create Read Update Delete (CRUD) operations
HATEOAS: Hypermedia As The Engine Of Application State
A way for machines to understand APIs and navigate them without having any information about them beforehand
Hypermedia links and forms to tell the client "what he can do next"
HATEOAS: Hypermedia As The Engine Of Application State
Improves key non-functional API requirements:
HATEOAS: Hypermedia As The Engine Of Application State
Example with links in the retrieved messages
HATEOAS: Hypermedia As The Engine Of Application State
Example with Links in the HTTP header
Link: <https://api.github.com/repositories/302322/contributors?page=2>; rel="next",
<https://api.github.com/repositories/302322/contributors?page=13>; rel="last"
RFC 8288 Web Linking
Link: <targetURL>; rel="typeOfRelation"; someAttribute="someValue someOtherValue" ,
<otherTarget>; rel="relation"; someAttribute="someValue http://someURL/value" ,
<otherTarget>; rel="relation"; someAttribute="someValue" ; anchor=<URLOfStartOfRelation>
RFC 8288 Web Linking
Response:. See td:Link in W3C Thing Description https://w3c.github.io/wot-thing-description/
Enabling hypermedia control with the CoRE link format (RFC 6690, August 2012)
Simply HTTP header parameter Link: … in a document
defines three new Link Target Attribute:
</sensors/temp>;rt="temperature-c";if="sensor",
</sensors/light>;rt="light-lux";if="sensor"
Enabling hypermedia control with the CoRE link format (RFC 6690, August 2012)
Simply HTTP header parameter Link: … in a document
REQ: GET /.well-known/core
RES: 2.05 Content
</sensors>;ct=40
REQ: GET /sensors
RES: 2.05 Content
</sensors/temp>;rt="temperature-c";if="sensor",
</sensors/light>;rt="light-lux";if="sensor"
The Constrained RESTful Application Language
Under development, latest version March 2019
Concise Binary Object Representation (CBOR, RFC 7049, Oct 2013)
Very good Wikipedia page https://en.wikipedia.org/wiki/CBOR
The goal is not to reduce the files, but to reduce the implementations.
Many text: small compression
Concise Binary Object Representation (CBOR, RFC 7049, Oct 2013)
Main Idea: data item start with one byte X.YY
X = 3 bits Major Type
Y = 5 bits Additional Information
Concise Binary Object Representation (CBOR, RFC 7049, Oct 2013)
Main Idea: data item start with one byte X.YY
X = 3 bits Major Type
Y = 5 bits Additional Information
Concise Binary Object Representation (CBOR, RFC 7049, Oct 2013)
Main Idea: data item start with one byte X.YY
X = 3 bits Major Type
Y = 5 bits Additional Information
Major type 6.YY: optional semantic tagging of other major types
Major type 7.YY: floating-point numbers and simple data types that need no content, as well as the "break" stop code
Efficient XML Interchange (EXI, W3C REC, Feb 2014)
https://www.w3.org/TR/exi-primer/ Main Idea:
EXI stream = EXI header (options) + EXI body (sequence of EXI events)
each XML Datatype defines specific encoding rules
Efficient XML Interchange (EXI, W3C REC, Feb 2014)
<?xml version="1.0" encoding="UTF-8"?>
<notebook date="2007-09-12">
<note category="EXI" date="2007-07-23">
<subject>EXI</subject>
<body>Do not forget it!</body>
</note>
<note date="2007-09-12">
<subject>Shopping List</subject>
<body>milk, honey</body>
</note>
</notebook>
Efficient XML Interchange (EXI, W3C REC, Feb 2014)
Efficient XML Interchange (EXI, W3C REC, Feb 2014)
Not the same design choices
Sensor Measurement Lists (SenML) (SenML, STF8428, Aug 2018)
[
{"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09,
"v":23.5},
{"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020091e+09,
"v":23.6}
]
Sensor Measurement Lists (SenML) (SenML, STF8428, Aug 2018)
. +---------------+-------+-----------+
| Name | Label | JSON Type |
+---------------+-------+-----------+
| Name | n | String |
| Unit | u | String |
| Value | v | Number |
| String Value | vs | String |
| Boolean Value | vb | Boolean |
| Data Value | vd | String |
| Sum | s | Number |
| Time | t | Number |
| Update Time | ut | Number |
Sensor Measurement Lists (SenML) (SenML, STF8428, Aug 2018)
. +---------------+-------+-----------+
| Name | Label | JSON Type |
+---------------+-------+-----------+
| Base Name | bn | String |
| Base Time | bt | Number |
| Base Unit | bu | String |
| Base Value | bv | Number |
| Base Sum | bs | Number |
(this is a IANA registry)
Sensor Measurement Lists (SenML) (SenML, STF8428, Aug 2018)
IANA Registry for SenML Units
Sensor Measurement Lists (SenML) (SenML, STF8428, Aug 2018)
/