(Iot) to Web of Things (Wot): Protocols, Data Formats, Etc. MINES
Total Page:16
File Type:pdf, Size:1020Kb
From Internet of Things (IoT) to Web of Things (WoT): Protocols, data formats, etc. MINES Saint-Étienne, CNRS Lab Hubert Curien UMR 5516 Amelie Gyrard & Maxime Lefrancois [email protected] [email protected] 9 November 2017 Agenda I. Introduction: Web of Things (WoT) o Pioneer o W3C WoT Architecture II. Protocols, Formats & Tools o Protocols: MQTT, CoAP, etc. o Format: XML, JSON, etc. o Tools: NodeRed, Postman, etc. III. Towards the Semantic Web of Things (SWoT) o Ontology Catalogue for IoT with LOV4IoT o Deducing meaningful information from sensor data – Reasoning with SLOR o Semantic-based Smart Cities IV. In parallel: Quizz, Demos, MindMaps V. Conclusion: Evaluation form, Assignments, Project Suggestions 2 The rules for this class: Rule 1: Answer the quizz! Rule 2: Follow interactive demos on your computer! Rule 3: Take notes you have an evaluation form at this end of the class! Rule 4: Assignments to learn much more at home! 3 Agenda I. Introduction: Web of Things (WoT) o Pioneer o W3C WoT Architecture II. Protocols, Formats & Tools III. Towards the Semantic Web of Things (SWoT) IV. In parallel: Quizz, Demos, MindMaps V. Conclusion: Evaluation form, Assignments, Project Suggestions 4 Before IoT and WoT • Marc Weiser o Father of Ubiquitous Computing o 1991 o The Computer for the 21st Century [1] • Also Pervasive Computing, Context Awereness, etc/ • Also Internet of Things (IoT) o Kevin Ashton o 1999: Beginning of RFIDs (Radio Frequency Identification) o Usage of Internet • Without the need to use web technologies [1] http://www.ubiq.com/hypertext/weiser/SciAmDraft3.html 5 Connecting the things to the Web • Example: NetAtmo provides web-based applications to monitor data. 6 Assignment • Find and classify other devices (e.g., NetAtmo) providing web-based visualizations and access to data generated. o Documentation for developers, technologies, cost, etc. 7 Do you know who is this person? 8 Tim Berners Lee • Inventor of the World Wide Web in 1989 • Director of the World Wide Web Consortium (W3C) • He received the 2016 Turing Award "for inventing the World Wide Web, the first web browser, and the fundamental protocols and algorithms allowing the Web to scale“. 9 What is the Web of Things (WoT)? Who is the pioneer of WoT? 10 Pioneer of the Web of Things (WoT): Dominique Guinard • PhD thesis: A Web of Things Application Architecture [Guinard 2011] • Book: Building the Web of Things [Guinard and Trifa 2016] • Book: Using the Web to build the IoT [Guinard and Trifa 2016] • Co-founder & CTO EVRYTHNG • Web of Things community in 2007 11 Recommendations: WoT Books to read 12 Towards the Web of Things (WoT) • Internet of Things basics have been introduced in the previous classes. • How to send data produces by sensors/devices to the web o Connecting the things/objects to the Web! => The Web of Things (WoT)! • => We need some protocols? o The applications accessing the sensor data need to know how to communicate with the objects, e.g., which protocols to use. 13 OSI (Open Systems Interconnection) Model • OSI model already learnt (IoT, Reseaux, Programmable Web) • In this class: mainly focused on the application and presentation layers https://www.postscapes.com/internet-of-things-protocols/ 14 Web of Things (WoT) & OSI model layer Book: Building the Web of Things [Guinard and Trifa 2016] 15 HTTP: Hypertext Transfer Protocol • HTTP is an application layer protocol that allows web- based application to communicate and exchange data • Analogy: Carrier pigeons, post mail: 16 HTTP: List of Headers https://en.wikipedia.org/wiki/List_of_HTTP_header_fields 17 Assignment HTTP: Video to watch at home https://www.youtube.com/watch?v=eesqK59rhGA 18 W3C Web of Things (WoT) & W3C WoT Architecture • World Wide Web Consortium (W3C) o Standardisation for the web • W3C Web of Things Interest Group (WoT IG) proposed the notion of “Servient” that is currently being defined to standardized software objects in WoT applications [1] [1] https://www.w3.org/WoT/IG 19 Web Services with REST • REST: Representational State Transfer • REST is an architectural style for developing distributed applications and is the basis upon the web is built. • Loosely coupled services that can be easily reused • Services implemented using URIs, HTTP, and standardized media types. • Application programming interface (API) to interact with Things PhD Thesis: https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm [Fielding 2000] https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1 20 REST • RESTful Web services o Java implementation: JAX-RS • HATEOAS: Hypermedia As The Engine Of Application State o A way for machines to understand APIs and navigate them without having any information about them beforehand • HYDRA o http://www.hydra-cg.com/ 21 Web of Things • Mainly based on Web technologies o Web services o URLs and URIs: set of readable characters and a way to locate the resource E.g., https://www.youtube.com/ o HTML for provifing the Graphical User Interface (GUI) o JavaScript o CSS for customizing the GUI 22 Agenda I. Introduction: Web of Things (WoT) II. Protocols, Formats, Useful Tools o Protocols: MQTT, CoAP, etc. o Format: XML, JSON, etc. o Tools: NodeRed, Postman, etc. III. Towards the Semantic Web of Things (SWoT) IV. In parallel: Quizz, Demos, MindMaps V. Conclusion: Evaluation form, Assignments, Project Suggestions 23 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 24 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 25 Request/Response • Request/response: the first computer sends a request for some data and the second computer responds to the request. o Example: HTTP, CoAP • Analogy: o Ring the doorbell, call somebody https://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part- 1--net-31177 26 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 27 Publish/subscribe • Publish/subscribe (Pub/sub): o Publishers are sending messages o Subscribers are receiving messages o Publishers and subscribers don’t know about the existence of one another. o Broker, which is known by both the publisher and subscriber, which filters all incoming messages and distributes them accordingly. o Example: MQTT, XMPP • Analogy: o Follow someone/something on Facebook and receive notifications 28 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 29 HTTP 30 Postman: Plugin for Chrome to query APIs/web services Real-time Demo 31 Real-time Demo • http://devices.webofthings.io Book: Building the Web of Things [Guinard and Trifa 2016] 32 Postman Example Book: Building the Web of Things [Guinard and Trifa 2016] 33 Postman Example: Asking for JSON Book: Building the Web of Things [Guinard and Trifa 2016] 34 Content Negociation • The process of asking for a specific encoding is called content negociation in the HTTP 1.1 specification. 35 Postman Example: Asking data from a specific device Book: Building the Web of Things [Guinard and Trifa 2016] 36 Postman – HTTP Headers 37 Postman – HTTP Headers 38 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 39 COAP Video https://www.youtube.com/watch?v=O4aaICV8ywA 40 CoAP: Constrained Application Protocol • Internet Engineering Task Force Standard for Internet of Things • Instead of having http:// o Coap://myhouse.local/lamps.7/status • HTTP like verbs: GET, POST, PUT, DELETE, OBSERVE, DISCOVERY 41 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 42 MQTT video https://www.youtube.com/watch?v=exMm-fmU5ck 43 MQTT (MQ Telemetry Transport) Protocol • MQTT is a lightweight publish/subscribe messaging protocol • MQTT is light weight, open, simple, and designed so as to be easy to implement. • Eclipse Mosquitto™ is an open source message broker that implements the MQTT protocol [1] https://mosquitto.org/ http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html 44 Assignment: MQTT Hands-on session • Getting Started With MQTT and Java o http://tgrall.github.io/blog/2017/01/02/getting-started-with-mqtt/ 45 MQTT @Eclipse IoT • Eclipse: Integrated Environment Development (IDE) • Moquitto: light and full feature broker • Paho for clients (Java, C/C++, Python, Js, Go, Lua) • Moquette: Java Broker with websockets • Ponte: Node.js server bridging MQTT, HTTP, CoAP • Kura: M2M application framework with MQTT as default transport 46 CloudMQTT • Implementation of MQTT based on Mosquitto • Will be used for the hands-on session https://www.cloudmqtt.com/docs.html 47 Interaction Protocols: Application Layer Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 48 XMPP • XMPP: Extensible Messaging and Presence Protocol o Chat Protocol based on XML o Improved for IoT Interaction Protocols Request/Response Publish/Subscribe E.g., HTTP E.g., CoAP E.g., MQTT E.g., XMPP 49 Data exchange can be done with: Data Serialization Format JSON XML EXI CBOR CSV EXCEL Etc. 50 Data Format: XML • XML: eXtensible Markup Data Format Language o Markup language that defines a set JSON XML of rules for encoding documents in a format that is both human-readable and machine-readable o Less and les less popular because of EXI CBOR JSON CSV Excel Etc. • XML Example: 51 Data Format: JSON Data Format • See also Course Programmable JSON XML Web EXI CBOR • JSON is becoming more and more popular, it replaces more and more XML CSV Excel • JSON can be easily used in web services.