SlideShare une entreprise Scribd logo
1  sur  64
Télécharger pour lire hors ligne
Hands-on with CoAP
Embrace the Internet of Things!
Matthias Kovatsch
Julien Vermillard
Follow the slides
http://goo.gl/LLQ03w
Your devoted presenters :-)
Julien Vermillard / @vrmvrm
Software Engineer at Sierra Wireless
http://airvantage.net M2M Cloud
Apache member, Eclipse committer on
Californium and Wakaama
More IoT stuff:
https://github.com/jvermillard
Your devoted presenters :-)
Matthias Kovatsch
Researcher at ETH Zurich, Switzerland
Focus on Web technology for the IoT
IETF contributor in CoRE and LWIG
Author of Californium (Cf),
Erbium (Er), and Copper (Cu)
http://people.inf.ethz.ch/mkovatsc
Agenda
Internet of things 101
What protocols should I use?
CoAP
What is CoAP?
CoAP live!
Californium
HANDS-ON!
More CoAP goodies
What you will need
Eclipse IDE
Basic Java knowledge
Californium JARs
Firefox + Copper
Your brainzzz
Content of the USB stick
● Eclipse IDE for Windows, Linux and Mac
● Firefox and Copper .xpi
● Sample projects to be imported in your
workspace
+ Californium JAR file
● Completed projects
Machine to machine?
Machine to machine?
Internet of things?
Technology that
supports
wired or wireless
communication
between devices
❝
Different needs, different protocols
Device Management
Radio statististics, device configuration, …
OMA-DM, TR-069, LWM2M…
Local sensor networks
Transmit sensor data, usually over RF or PLC
Zigbee, X10, Bluetooth Smart, …
End-user applications
Display sensor data on mobile app, dashboards,
HTTP, Websockets, ...
The Web of Things
Application layer interoperability
and usability for the IoT
Tiny resource-constrained devices
Class 1 devices
~100KiB Flash
~10KiB RAM
Target of less than 1$
Tiny resource-constrained devices
TCP and HTTP
are not a good fit
Low-power networks
Constrained Application Protocol
RESTful protocol designed from scratch
Transparent mapping to HTTP
Additional features of M2M scenarios
GET, POST, PUT, DELETE
URIs and media types
Deduplication
Optional retransmissions
Constrained Application Protocol
Binary protocol
● Low parsing complexity
● Small message size
Options
● Numbers with IANA registry
● Type-Length-Value
● Special option header
marks payload if present
Observing resources
Observing resources - CON mode
RESTful Group Communication
GET /status/power
PUT /control/color
#00FF00
Resource discovery
Based on Web Linking (RFC5988)
Extended to Core Link Format (RFC6690)
Multicast Discovery
Resource Directories
</config/groups>;rt="core.gp";ct=39,
</sensors/temp>;rt="ucum.Cel";ct="0 50";obs,
</large>;rt="block";sz=1280
;title="Large resource"
GET /.well-known/core
Alternative transports
Short Message Service (SMS)
Unstructured Supplementary
Service Data (USSD)
*101#
Addressable through URIs
coap+sms://+12345/bananas/temp*
Could power up subsystems for
IP connectivity after SMS signal
* illustration only, +12345 unfortunately not allowed by URI RFC
Security
Based on DTLS (TLS/SSL for Datagrams)
Focus on Elliptic Curve Cryptography (ECC)
Hardware acceleration for IoT devices
Status of CoAP
Proposed Standard since 15 Jul 2013
RFC 7252
Next working group documents in the queue
● Observing Resources
● Group Communication
● Blockwise Transfers
● Resource Directory
● HTTP Mapping Guidelines
Status of CoAP
In use by
● OMA Lightweight M2M
● IPSO Alliance
● ETSI M2M
● Device management for network operators
● Lighting systems for smart cities
CoAP live with Copper!
Browsing and bookmarking
of CoAP URIs
Interaction with resource like
RESTClient or Poster
Treat tiny devices like
normal RESTful Web services
CoAP protocol handler for Mozilla Firefox
Copper (Cu) CoAP user-agent
CoAP live with Copper!
Dual color LED strip with microcoap
Connect on the “coap” wifi network
Password: “coapcoap”
coap://192.168.1.252:5683/
A more complex sandbox
coap://192.168.1.100:5683/
or with Internet
coap://vs0.inf.ethz.ch:5683/
coap://coap.me:5683/
Californium (Cf) CoAP framework
Unconstrained CoAP implementation
● written in Java
● focus on scalability and usability
For
● IoT cloud services
● Stronger IoT devices
(Java SE Embedded or special JVMs)
Stages
● Decoupled with
message queues
● independent
concurrency models
● Adjusted statically for
platform/application
● Stage 1 depends on
OS and transport
● Stage 2 usually
one thread per core
3-stage architecture
Exchange
Store
Blockwise Layer
Observe Layer
Token Layer
Reliability Layer
Matching & Deduplication
Message Serialization
Transport (socket I/O)
Stage1Stage2:Protocol(CoAP)Stage3:Logic
Network
A1
A2
B2
B1
A
B
Root
Web resources
● Optional thread pool
for each Web resource
● Inherited by parent
or transitive ancestor
● Protocol threads used
if none defined
Stage 3: server role
Exchange
Store
Blockwise Layer
Observe Layer
Token Layer
Reliability Layer
Matching & Deduplication
Message Serialization
Transport (socket I/O)
Stage1Stage2:Protocol(CoAP)Stage3:Logic
Network
A1
A2
B2
B1
A
B
Root
Clients with
response handlers
● Object API called from
main or user thread
● Synchronous:
Protocol threads
unblock API calls
● Asynchronous:
Optional thread pools
for response handling
(e.g., when observing)
Stage 3: client role
Exchange
Store
Blockwise Layer
Observe Layer
Token Layer
Reliability Layer
Matching & Deduplication
Message Serialization
Transport (socket I/O)
Stage1Stage2:Protocol(CoAP)Stage3:Logic
Network
Client for B
Client for A
Async. Client
main
Encapsulate stages 1+2
Enable
● multiple channels
● stack variations for
different transports
Individual concurrency
models, e.g., for DTLS
Endpoints
Stack
UDP
Stage1Stage2:Protocol(CoAP)Stage3:Logic
A1
A2
B2
B1
A
B
Root
Stack
DTLS
Stack
...
Implemented in
CoapEndpoint
Separation of
bookkeeping
and processing
Exchanges
carry state
Endpoints
CoapEndpoint
MessageInterceptorMessageInterceptor
Matcher
MessageInterceptor
Deduplicator
Message
Exchange
Message
Message
Message
Message
Message
Exchange
Message
Exchange
Message
Exchange
Message
Exchange
CoapStack
Blockwise Layer
Observe Layer
Token Layer
Reliability Layer
Connector
Exchange
Forwarder
(Impl)
Data
Serializer
RawData
Channel
(Impl)
Data
Parser
MessageDelivererStackTopAdapter
DataData
Paper on evaluation
at IoT 2014
Matthias Kovatsch,
Martin Lanter, and
Zach Shelby.
Scalable Cloud Services
for the Internet of Things.
In Proc. IoT, Cambridge, MA, USA, 2014.
http://www.iot-conference.org/iot2014/
Requestspersecond
Without Keep-Alive
Let’s get concrete!
Project structure
Five repositories on GitHub
● https://github.com/eclipse/californium
Core library and example projects
● https://github.com/eclipse/californium.element-connector
Abstraction for modular network stage (Connectors)
● https://github.com/eclipse/californium.scandium
DTLS 1.2 implementation for network stage (DtlsConnector)
● https://github.com/eclipse/californium.tools
Stand-alone CoAP tools such as console client or RD
● https://github.com/eclipse/californium.actinium
App server for server-side JavaScript*
*not yet ported to new implementation and using deprecated CoAP draft version
Maven
Maven artifacts will be available at
https://repo.eclipse.org/content/repositories/californium-snapshots/
https://repo.eclipse.org/content/repositories/californium-releases/
once migration to Eclipse is complete
If release version is required use old
ch.ethz.inf.vs artifacts from
https://github.com/mkovatsc/maven
Code structure
https://github.com/eclipse/californium
● Libraries (“californium-” prefix)
○ californium-core CoAP, client, server
○ californium-osgi OSGi wrapper
○ californium-proxy HTTP cross-proxy
● Example code
● Example projects (“cf-” prefix)
Code structure
https://github.com/eclipse/californium
● Libraries
● Example code
○ cf-api-demo API call snippets
● Example projects
Code structure
https://github.com/eclipse/californium
● Libraries
● Example code
● Example projects
○ cf-helloworld-client basic GET client
○ cf-helloworld-server basic server
○ cf-plugtest-checker tests Plugtest servers
○ cf-plugtest-client tests client functionality
○ cf-plugtest-server tests server functionality
○ cf-benchmark performance tests
○ cf-secure imports Scandium (DTLS)
○ cf-proxy imports californium-proxy
Server API
Important classes (see org.eclipse.californium.core)
● CoapServer
● CoapResource
● CoapExchange
● Implement custom resources
by extending CoapResource
● Add resources to server
● Start server
Server API - resources
import static org.eclipse.californium.core.coap.CoAP.ResponseCode.*; // shortcuts
public class MyResource extends CoapResource {
@Override
public void handleGET(CoapExchange exchange) {
exchange.respond("hello world"); // reply with 2.05 payload (text/plain)
}
@Override
public void handlePOST(CoapExchange exchange) {
exchange.accept(); // make it a separate response
if (exchange.getRequestOptions()....) {
// do something specific to the request options
}
exchange.respond(CREATED); // reply with response code only (shortcut)
}
}
Server API - creation
public static void main(String[] args) {
CoapServer server = new CoapServer ();
server.add(new MyResource("hello"));
server.start(); // does all the magic
}
Client API
Important classes
● CoapClient
● CoapHandler
● CoapResponse
● CoapObserveRelation
● Instantiate CoapClient with target URI
● Use offered methods get(), put(), post(), delete(),
observe(), validate(), discover(), or ping()
● Optionally define CoapHandler for
asynchronous requests and observe
Client API - synchronous
public static void main(String[] args) {
CoapClient client1 = new CoapClient("coap://iot.eclipse.org:5683/multi-format");
String text = client1.get().getResponseText(); // blocking call
String xml = client1.get(APPLICATION_XML).getResponseText();
CoapClient client2 = new CoapClient("coap://iot.eclipse.org:5683/test");
CoapResponse resp = client2.put("payload", TEXT_PLAIN); // for response details
System.out.println( resp.isSuccess() );
System.out.println( resp.getOptions() );
client2.useNONs(); // use autocomplete to see more methods
client2.delete();
client2.useCONs().useEarlyNegotiation(32).get(); // it is a fluent API
}
Client API - asynchronous
public static void main(String[] args) {
CoapClient client = new CoapClient("coap://iot.eclipse.org:5683/separate");
client.get(new CoapHandler() { // e.g., anonymous inner class
@Override public void onLoad(CoapResponse response) { // also error resp.
System.out.println( response.getResponseText() );
}
@Override public void onError() { // I/O errors and timeouts
System.err.println("Failed");
}
});
}
Client API - observe
public static void main(String[] args) {
CoapClient client = new CoapClient("coap://iot.eclipse.org:5683/obs");
CoapObserveRelation relation = client.observe(new CoapHandler() {
@Override public void onLoad(CoapResponse response) {
System.out.println( response.getResponseText() );
}
@Override public void onError() {
System.err.println("Failed");
}
});
relation.proactiveCancel();
}
Advanced API
Get access to internal objects with
advanced() on
CoapClient, CoapResponse, CoapExchange
Use clients in resource handlers with
createClient(uri);
Define your own concurrency models with
ConcurrentCoapResource and
CoapClient.useExecutor() / setExecutor(exe)
HANDS-ON!
Getting started
● Launch Eclipse
● Import projects contained on the USB
stick
○ File > Import… > Existing projects into
workspace
Step 1
The mandatory Hello world CoAP server!
1. Complete the code:
Add “hello” resource with a custom message
Run the CoAP server
2. Test with Copper
Step 2
Improve the server by adding:
1. A “subpath/another” hello world
2. Current time in milliseconds
3. A writable resource
4. A removable resource
Step 3
Hello world CoAP client
1. Complete the code for reading the
previous “helloworld” values
2. Connect your client with your server
More fun
Connect with the LED strip
Read the sensors
Change the color
Have fun!
Where is the code?
Tutorial steps
https://github.com/jvermillard/hands-on-coap
Californium
https://github.com/eclipse?query=californium
Hands-off
Questions?
Photo Credit:oskay
Going further with CoAP
Going further with CoAP
Scandium (Sc)
DTLS (TLS/SSL for UDP) for adding
security
Californium (Cf) Proxy
HTTP/CoAP proxy
Californium (Cf) RD
CoAP resource directory
Going further
Contiki OS
Connects tiny, low-power MCU to the
Internet
http://contiki-os.org
Microcoap
CoAP for arduino
https://github.com/1248/microcoap
OMA Lightweight M2M
An device management protocol
Created by the Open Mobile Alliance
Configure, monitor, upgrade your device
using CoAP over UDP and SMS
In a RESTful way!
OMA Lightweight M2M
The specification
http://technical.openmobilealliance.org
C client library (future eclipse wakaama)
http://github.com/01org/liblwm2m
Java server implementation
http://github.com/jvermillard/leshan/
Thanks!
More questions? Feel free to contact us!
Matthias Kovatsch
kovatsch@inf.ethz.ch
Julien Vermillard
@vrmvrm
jvermillard@sierrawireless.com

Contenu connexe

Tendances

MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsBryan Boyd
 
MQTT - Protocol for the Internet of Things
MQTT - Protocol for the Internet of ThingsMQTT - Protocol for the Internet of Things
MQTT - Protocol for the Internet of ThingsUniversity of Pretoria
 
Getting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationGetting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationChristian Götz
 
ARM CoAP Tutorial
ARM CoAP TutorialARM CoAP Tutorial
ARM CoAP Tutorialzdshelby
 
MQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionMQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionPrem Sanil
 
Hands on with lightweight m2m and Eclipse Leshan
Hands on with lightweight m2m and Eclipse LeshanHands on with lightweight m2m and Eclipse Leshan
Hands on with lightweight m2m and Eclipse LeshanJulien Vermillard
 
Mqtt overview (iot)
Mqtt overview (iot)Mqtt overview (iot)
Mqtt overview (iot)David Fowler
 
MQTT Protocol: IOT Technology
MQTT Protocol: IOT TechnologyMQTT Protocol: IOT Technology
MQTT Protocol: IOT TechnologyShashank Kapoor
 
Introduction MQTT in English
Introduction MQTT in EnglishIntroduction MQTT in English
Introduction MQTT in EnglishEric Xiao
 
Mqtt – a protocol for the internet of things
Mqtt – a protocol for the internet of thingsMqtt – a protocol for the internet of things
Mqtt – a protocol for the internet of thingsRahul Gupta
 
MQTT - The Internet of Things Protocol
MQTT - The Internet of Things ProtocolMQTT - The Internet of Things Protocol
MQTT - The Internet of Things ProtocolBen Hardill
 
Vpn(virtual private network)
Vpn(virtual private network)Vpn(virtual private network)
Vpn(virtual private network)sonangrai
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Peter R. Egli
 
CoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenariosCoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenarioscarlosralli
 

Tendances (20)

MQTT and CoAP
MQTT and CoAPMQTT and CoAP
MQTT and CoAP
 
MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of Things
 
6lowpan
6lowpan6lowpan
6lowpan
 
MQTT - Protocol for the Internet of Things
MQTT - Protocol for the Internet of ThingsMQTT - Protocol for the Internet of Things
MQTT - Protocol for the Internet of Things
 
Getting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationGetting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentation
 
ARM CoAP Tutorial
ARM CoAP TutorialARM CoAP Tutorial
ARM CoAP Tutorial
 
MQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionMQTT IOT Protocol Introduction
MQTT IOT Protocol Introduction
 
Hands on with lightweight m2m and Eclipse Leshan
Hands on with lightweight m2m and Eclipse LeshanHands on with lightweight m2m and Eclipse Leshan
Hands on with lightweight m2m and Eclipse Leshan
 
An introduction to MQTT
An introduction to MQTTAn introduction to MQTT
An introduction to MQTT
 
Mqtt overview (iot)
Mqtt overview (iot)Mqtt overview (iot)
Mqtt overview (iot)
 
MQTT Protocol: IOT Technology
MQTT Protocol: IOT TechnologyMQTT Protocol: IOT Technology
MQTT Protocol: IOT Technology
 
Introduction MQTT in English
Introduction MQTT in EnglishIntroduction MQTT in English
Introduction MQTT in English
 
Mqtt – a protocol for the internet of things
Mqtt – a protocol for the internet of thingsMqtt – a protocol for the internet of things
Mqtt – a protocol for the internet of things
 
MQTT - The Internet of Things Protocol
MQTT - The Internet of Things ProtocolMQTT - The Internet of Things Protocol
MQTT - The Internet of Things Protocol
 
Vpn(virtual private network)
Vpn(virtual private network)Vpn(virtual private network)
Vpn(virtual private network)
 
How MQTT work ?
How MQTT work ?How MQTT work ?
How MQTT work ?
 
Xmpp
XmppXmpp
Xmpp
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)
 
Drive into calico architecture
Drive into calico architectureDrive into calico architecture
Drive into calico architecture
 
CoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenariosCoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenarios
 

Similaire à Hands on with CoAP and Californium

Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Thomas Weise
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!QAware GmbH
 
SDN/OpenFlow #lspe
SDN/OpenFlow #lspeSDN/OpenFlow #lspe
SDN/OpenFlow #lspeChris Westin
 
Osnug meetup-tungsten fabric - overview.pptx
Osnug meetup-tungsten fabric - overview.pptxOsnug meetup-tungsten fabric - overview.pptx
Osnug meetup-tungsten fabric - overview.pptxM.Qasim Arham
 
The constrained application protocol (coap)
The constrained application protocol (coap)The constrained application protocol (coap)
The constrained application protocol (coap)Hamdamboy
 
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...Provectus
 
High-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQLHigh-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQLScyllaDB
 
6 open capi_meetup_in_japan_final
6 open capi_meetup_in_japan_final6 open capi_meetup_in_japan_final
6 open capi_meetup_in_japan_finalYutaka Kawai
 
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ... The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...Josef Adersberger
 
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...QAware GmbH
 
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
Pulsar summit asia 2021   apache pulsar with mqtt for edge computingPulsar summit asia 2021   apache pulsar with mqtt for edge computing
Pulsar summit asia 2021 apache pulsar with mqtt for edge computingTimothy Spann
 
The advantages of Arista/OVH configurations, and the technologies behind buil...
The advantages of Arista/OVH configurations, and the technologies behind buil...The advantages of Arista/OVH configurations, and the technologies behind buil...
The advantages of Arista/OVH configurations, and the technologies behind buil...OVHcloud
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
OpenStack & OpenContrail in Production
OpenStack & OpenContrail in ProductionOpenStack & OpenContrail in Production
OpenStack & OpenContrail in ProductionEdgar Magana
 
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...GetInData
 
Distributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaDistributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaMax Alexejev
 
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarTimothy Spann
 
Interoperability Fundamentals: SWORD 2
Interoperability Fundamentals: SWORD 2Interoperability Fundamentals: SWORD 2
Interoperability Fundamentals: SWORD 2Adrian Stevenson
 

Similaire à Hands on with CoAP and Californium (20)

Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
 
Introduction to Apache Beam
Introduction to Apache BeamIntroduction to Apache Beam
Introduction to Apache Beam
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
 
SDN/OpenFlow #lspe
SDN/OpenFlow #lspeSDN/OpenFlow #lspe
SDN/OpenFlow #lspe
 
Osnug meetup-tungsten fabric - overview.pptx
Osnug meetup-tungsten fabric - overview.pptxOsnug meetup-tungsten fabric - overview.pptx
Osnug meetup-tungsten fabric - overview.pptx
 
The constrained application protocol (coap)
The constrained application protocol (coap)The constrained application protocol (coap)
The constrained application protocol (coap)
 
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...
Data Summer Conf 2018, “Building unified Batch and Stream processing pipeline...
 
KONG-APIGateway.pptx
KONG-APIGateway.pptxKONG-APIGateway.pptx
KONG-APIGateway.pptx
 
High-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQLHigh-speed Database Throughput Using Apache Arrow Flight SQL
High-speed Database Throughput Using Apache Arrow Flight SQL
 
6 open capi_meetup_in_japan_final
6 open capi_meetup_in_japan_final6 open capi_meetup_in_japan_final
6 open capi_meetup_in_japan_final
 
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ... The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
 
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
Pulsar summit asia 2021   apache pulsar with mqtt for edge computingPulsar summit asia 2021   apache pulsar with mqtt for edge computing
Pulsar summit asia 2021 apache pulsar with mqtt for edge computing
 
The advantages of Arista/OVH configurations, and the technologies behind buil...
The advantages of Arista/OVH configurations, and the technologies behind buil...The advantages of Arista/OVH configurations, and the technologies behind buil...
The advantages of Arista/OVH configurations, and the technologies behind buil...
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
OpenStack & OpenContrail in Production
OpenStack & OpenContrail in ProductionOpenStack & OpenContrail in Production
OpenStack & OpenContrail in Production
 
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
 
Distributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaDistributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and Scala
 
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
 
Interoperability Fundamentals: SWORD 2
Interoperability Fundamentals: SWORD 2Interoperability Fundamentals: SWORD 2
Interoperability Fundamentals: SWORD 2
 

Plus de Julien Vermillard

The 5 elements of IoT security
The 5 elements of IoT securityThe 5 elements of IoT security
The 5 elements of IoT securityJulien Vermillard
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Julien Vermillard
 
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?M2M, IOT, Device Managment: COAP/LWM2M to rule them all?
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?Julien Vermillard
 
IoT Toulouse : introduction à mqtt
IoT Toulouse : introduction à mqttIoT Toulouse : introduction à mqtt
IoT Toulouse : introduction à mqttJulien Vermillard
 
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014Julien Vermillard
 
Introduction to CoAP the REST protocol for M2M
Introduction to CoAP the REST protocol for M2MIntroduction to CoAP the REST protocol for M2M
Introduction to CoAP the REST protocol for M2MJulien Vermillard
 

Plus de Julien Vermillard (6)

The 5 elements of IoT security
The 5 elements of IoT securityThe 5 elements of IoT security
The 5 elements of IoT security
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
 
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?M2M, IOT, Device Managment: COAP/LWM2M to rule them all?
M2M, IOT, Device Managment: COAP/LWM2M to rule them all?
 
IoT Toulouse : introduction à mqtt
IoT Toulouse : introduction à mqttIoT Toulouse : introduction à mqtt
IoT Toulouse : introduction à mqtt
 
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014
M2M, IoT, Device management: one protocol to rule them all? - EclipseCon 2014
 
Introduction to CoAP the REST protocol for M2M
Introduction to CoAP the REST protocol for M2MIntroduction to CoAP the REST protocol for M2M
Introduction to CoAP the REST protocol for M2M
 

Dernier

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Dernier (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

Hands on with CoAP and Californium

  • 1. Hands-on with CoAP Embrace the Internet of Things! Matthias Kovatsch Julien Vermillard
  • 3. Your devoted presenters :-) Julien Vermillard / @vrmvrm Software Engineer at Sierra Wireless http://airvantage.net M2M Cloud Apache member, Eclipse committer on Californium and Wakaama More IoT stuff: https://github.com/jvermillard
  • 4. Your devoted presenters :-) Matthias Kovatsch Researcher at ETH Zurich, Switzerland Focus on Web technology for the IoT IETF contributor in CoRE and LWIG Author of Californium (Cf), Erbium (Er), and Copper (Cu) http://people.inf.ethz.ch/mkovatsc
  • 5. Agenda Internet of things 101 What protocols should I use? CoAP What is CoAP? CoAP live! Californium HANDS-ON! More CoAP goodies
  • 6. What you will need Eclipse IDE Basic Java knowledge Californium JARs Firefox + Copper Your brainzzz
  • 7. Content of the USB stick ● Eclipse IDE for Windows, Linux and Mac ● Firefox and Copper .xpi ● Sample projects to be imported in your workspace + Californium JAR file ● Completed projects
  • 10. Technology that supports wired or wireless communication between devices ❝
  • 11. Different needs, different protocols Device Management Radio statististics, device configuration, … OMA-DM, TR-069, LWM2M… Local sensor networks Transmit sensor data, usually over RF or PLC Zigbee, X10, Bluetooth Smart, … End-user applications Display sensor data on mobile app, dashboards, HTTP, Websockets, ...
  • 12. The Web of Things
  • 13. Application layer interoperability and usability for the IoT
  • 14. Tiny resource-constrained devices Class 1 devices ~100KiB Flash ~10KiB RAM Target of less than 1$
  • 15. Tiny resource-constrained devices TCP and HTTP are not a good fit Low-power networks
  • 16. Constrained Application Protocol RESTful protocol designed from scratch Transparent mapping to HTTP Additional features of M2M scenarios GET, POST, PUT, DELETE URIs and media types Deduplication Optional retransmissions
  • 17. Constrained Application Protocol Binary protocol ● Low parsing complexity ● Small message size Options ● Numbers with IANA registry ● Type-Length-Value ● Special option header marks payload if present
  • 20. RESTful Group Communication GET /status/power PUT /control/color #00FF00
  • 21. Resource discovery Based on Web Linking (RFC5988) Extended to Core Link Format (RFC6690) Multicast Discovery Resource Directories </config/groups>;rt="core.gp";ct=39, </sensors/temp>;rt="ucum.Cel";ct="0 50";obs, </large>;rt="block";sz=1280 ;title="Large resource" GET /.well-known/core
  • 22. Alternative transports Short Message Service (SMS) Unstructured Supplementary Service Data (USSD) *101# Addressable through URIs coap+sms://+12345/bananas/temp* Could power up subsystems for IP connectivity after SMS signal * illustration only, +12345 unfortunately not allowed by URI RFC
  • 23. Security Based on DTLS (TLS/SSL for Datagrams) Focus on Elliptic Curve Cryptography (ECC) Hardware acceleration for IoT devices
  • 24. Status of CoAP Proposed Standard since 15 Jul 2013 RFC 7252 Next working group documents in the queue ● Observing Resources ● Group Communication ● Blockwise Transfers ● Resource Directory ● HTTP Mapping Guidelines
  • 25. Status of CoAP In use by ● OMA Lightweight M2M ● IPSO Alliance ● ETSI M2M ● Device management for network operators ● Lighting systems for smart cities
  • 26. CoAP live with Copper! Browsing and bookmarking of CoAP URIs Interaction with resource like RESTClient or Poster Treat tiny devices like normal RESTful Web services CoAP protocol handler for Mozilla Firefox
  • 27. Copper (Cu) CoAP user-agent
  • 28. CoAP live with Copper! Dual color LED strip with microcoap Connect on the “coap” wifi network Password: “coapcoap” coap://192.168.1.252:5683/ A more complex sandbox coap://192.168.1.100:5683/ or with Internet coap://vs0.inf.ethz.ch:5683/ coap://coap.me:5683/
  • 29.
  • 30. Californium (Cf) CoAP framework Unconstrained CoAP implementation ● written in Java ● focus on scalability and usability For ● IoT cloud services ● Stronger IoT devices (Java SE Embedded or special JVMs)
  • 31. Stages ● Decoupled with message queues ● independent concurrency models ● Adjusted statically for platform/application ● Stage 1 depends on OS and transport ● Stage 2 usually one thread per core 3-stage architecture Exchange Store Blockwise Layer Observe Layer Token Layer Reliability Layer Matching & Deduplication Message Serialization Transport (socket I/O) Stage1Stage2:Protocol(CoAP)Stage3:Logic Network A1 A2 B2 B1 A B Root
  • 32. Web resources ● Optional thread pool for each Web resource ● Inherited by parent or transitive ancestor ● Protocol threads used if none defined Stage 3: server role Exchange Store Blockwise Layer Observe Layer Token Layer Reliability Layer Matching & Deduplication Message Serialization Transport (socket I/O) Stage1Stage2:Protocol(CoAP)Stage3:Logic Network A1 A2 B2 B1 A B Root
  • 33. Clients with response handlers ● Object API called from main or user thread ● Synchronous: Protocol threads unblock API calls ● Asynchronous: Optional thread pools for response handling (e.g., when observing) Stage 3: client role Exchange Store Blockwise Layer Observe Layer Token Layer Reliability Layer Matching & Deduplication Message Serialization Transport (socket I/O) Stage1Stage2:Protocol(CoAP)Stage3:Logic Network Client for B Client for A Async. Client main
  • 34. Encapsulate stages 1+2 Enable ● multiple channels ● stack variations for different transports Individual concurrency models, e.g., for DTLS Endpoints Stack UDP Stage1Stage2:Protocol(CoAP)Stage3:Logic A1 A2 B2 B1 A B Root Stack DTLS Stack ...
  • 35. Implemented in CoapEndpoint Separation of bookkeeping and processing Exchanges carry state Endpoints CoapEndpoint MessageInterceptorMessageInterceptor Matcher MessageInterceptor Deduplicator Message Exchange Message Message Message Message Message Exchange Message Exchange Message Exchange Message Exchange CoapStack Blockwise Layer Observe Layer Token Layer Reliability Layer Connector Exchange Forwarder (Impl) Data Serializer RawData Channel (Impl) Data Parser MessageDelivererStackTopAdapter DataData
  • 36. Paper on evaluation at IoT 2014 Matthias Kovatsch, Martin Lanter, and Zach Shelby. Scalable Cloud Services for the Internet of Things. In Proc. IoT, Cambridge, MA, USA, 2014. http://www.iot-conference.org/iot2014/ Requestspersecond Without Keep-Alive
  • 38. Project structure Five repositories on GitHub ● https://github.com/eclipse/californium Core library and example projects ● https://github.com/eclipse/californium.element-connector Abstraction for modular network stage (Connectors) ● https://github.com/eclipse/californium.scandium DTLS 1.2 implementation for network stage (DtlsConnector) ● https://github.com/eclipse/californium.tools Stand-alone CoAP tools such as console client or RD ● https://github.com/eclipse/californium.actinium App server for server-side JavaScript* *not yet ported to new implementation and using deprecated CoAP draft version
  • 39. Maven Maven artifacts will be available at https://repo.eclipse.org/content/repositories/californium-snapshots/ https://repo.eclipse.org/content/repositories/californium-releases/ once migration to Eclipse is complete If release version is required use old ch.ethz.inf.vs artifacts from https://github.com/mkovatsc/maven
  • 40. Code structure https://github.com/eclipse/californium ● Libraries (“californium-” prefix) ○ californium-core CoAP, client, server ○ californium-osgi OSGi wrapper ○ californium-proxy HTTP cross-proxy ● Example code ● Example projects (“cf-” prefix)
  • 41. Code structure https://github.com/eclipse/californium ● Libraries ● Example code ○ cf-api-demo API call snippets ● Example projects
  • 42. Code structure https://github.com/eclipse/californium ● Libraries ● Example code ● Example projects ○ cf-helloworld-client basic GET client ○ cf-helloworld-server basic server ○ cf-plugtest-checker tests Plugtest servers ○ cf-plugtest-client tests client functionality ○ cf-plugtest-server tests server functionality ○ cf-benchmark performance tests ○ cf-secure imports Scandium (DTLS) ○ cf-proxy imports californium-proxy
  • 43. Server API Important classes (see org.eclipse.californium.core) ● CoapServer ● CoapResource ● CoapExchange ● Implement custom resources by extending CoapResource ● Add resources to server ● Start server
  • 44. Server API - resources import static org.eclipse.californium.core.coap.CoAP.ResponseCode.*; // shortcuts public class MyResource extends CoapResource { @Override public void handleGET(CoapExchange exchange) { exchange.respond("hello world"); // reply with 2.05 payload (text/plain) } @Override public void handlePOST(CoapExchange exchange) { exchange.accept(); // make it a separate response if (exchange.getRequestOptions()....) { // do something specific to the request options } exchange.respond(CREATED); // reply with response code only (shortcut) } }
  • 45. Server API - creation public static void main(String[] args) { CoapServer server = new CoapServer (); server.add(new MyResource("hello")); server.start(); // does all the magic }
  • 46. Client API Important classes ● CoapClient ● CoapHandler ● CoapResponse ● CoapObserveRelation ● Instantiate CoapClient with target URI ● Use offered methods get(), put(), post(), delete(), observe(), validate(), discover(), or ping() ● Optionally define CoapHandler for asynchronous requests and observe
  • 47. Client API - synchronous public static void main(String[] args) { CoapClient client1 = new CoapClient("coap://iot.eclipse.org:5683/multi-format"); String text = client1.get().getResponseText(); // blocking call String xml = client1.get(APPLICATION_XML).getResponseText(); CoapClient client2 = new CoapClient("coap://iot.eclipse.org:5683/test"); CoapResponse resp = client2.put("payload", TEXT_PLAIN); // for response details System.out.println( resp.isSuccess() ); System.out.println( resp.getOptions() ); client2.useNONs(); // use autocomplete to see more methods client2.delete(); client2.useCONs().useEarlyNegotiation(32).get(); // it is a fluent API }
  • 48. Client API - asynchronous public static void main(String[] args) { CoapClient client = new CoapClient("coap://iot.eclipse.org:5683/separate"); client.get(new CoapHandler() { // e.g., anonymous inner class @Override public void onLoad(CoapResponse response) { // also error resp. System.out.println( response.getResponseText() ); } @Override public void onError() { // I/O errors and timeouts System.err.println("Failed"); } }); }
  • 49. Client API - observe public static void main(String[] args) { CoapClient client = new CoapClient("coap://iot.eclipse.org:5683/obs"); CoapObserveRelation relation = client.observe(new CoapHandler() { @Override public void onLoad(CoapResponse response) { System.out.println( response.getResponseText() ); } @Override public void onError() { System.err.println("Failed"); } }); relation.proactiveCancel(); }
  • 50. Advanced API Get access to internal objects with advanced() on CoapClient, CoapResponse, CoapExchange Use clients in resource handlers with createClient(uri); Define your own concurrency models with ConcurrentCoapResource and CoapClient.useExecutor() / setExecutor(exe)
  • 52. Getting started ● Launch Eclipse ● Import projects contained on the USB stick ○ File > Import… > Existing projects into workspace
  • 53. Step 1 The mandatory Hello world CoAP server! 1. Complete the code: Add “hello” resource with a custom message Run the CoAP server 2. Test with Copper
  • 54. Step 2 Improve the server by adding: 1. A “subpath/another” hello world 2. Current time in milliseconds 3. A writable resource 4. A removable resource
  • 55. Step 3 Hello world CoAP client 1. Complete the code for reading the previous “helloworld” values 2. Connect your client with your server
  • 56. More fun Connect with the LED strip Read the sensors Change the color Have fun!
  • 57. Where is the code? Tutorial steps https://github.com/jvermillard/hands-on-coap Californium https://github.com/eclipse?query=californium
  • 60. Going further with CoAP Scandium (Sc) DTLS (TLS/SSL for UDP) for adding security Californium (Cf) Proxy HTTP/CoAP proxy Californium (Cf) RD CoAP resource directory
  • 61. Going further Contiki OS Connects tiny, low-power MCU to the Internet http://contiki-os.org Microcoap CoAP for arduino https://github.com/1248/microcoap
  • 62. OMA Lightweight M2M An device management protocol Created by the Open Mobile Alliance Configure, monitor, upgrade your device using CoAP over UDP and SMS In a RESTful way!
  • 63. OMA Lightweight M2M The specification http://technical.openmobilealliance.org C client library (future eclipse wakaama) http://github.com/01org/liblwm2m Java server implementation http://github.com/jvermillard/leshan/
  • 64. Thanks! More questions? Feel free to contact us! Matthias Kovatsch kovatsch@inf.ethz.ch Julien Vermillard @vrmvrm jvermillard@sierrawireless.com