Evolving REST for an IoT World
Todd L. Montgomery @toddlmontgomery
Evolving REST for an IoT World Todd L. Montgomery @toddlmontgomery - - PowerPoint PPT Presentation
Evolving REST for an IoT World Todd L. Montgomery @toddlmontgomery Representational State Transfer http://en.wikipedia.org/wiki/Representational_state_transfer @toddlmontgomery protocol noun \ pr -t - k o l, - k l, -
Todd L. Montgomery @toddlmontgomery
@toddlmontgomery
http://en.wikipedia.org/wiki/Representational_state_transfer
@toddlmontgomery
pro·to·col noun \ˈprō-tə-ˌkȯl, -ˌkōl, -ˌkäl, -kəl\
formatting of data in an electronic communications system <network protocols> ... 3 a : a code prescribing strict adherence to correct etiquette and precedence (as in diplomatic exchange and in the military services) <a breach of protocol>
@toddlmontgomery
Client - Server Cacheable Stateless
@toddlmontgomery
Uniform Interface
Hypermedia, Resources, URIs
Layered
Hmmm…
@toddlmontgomery
@toddlmontgomery
Tools - CLI Browser JSON
HTTP/1.1,TCP, [TLS/SSL], IP
@toddlmontgomery
@toddlmontgomery
Boards & Kits Environments JSON ??
HTTP/1.1 TLS/SSL? TCP IP Bluetooth MQTT SCADA Application App? App
Multiple Stacks
@toddlmontgomery
@toddlmontgomery
@toddlmontgomery
Request Response
RFC 2068, 2616, …, 7230-7240
Bi-Directional… kinda, but…
Event Event
… only
at-a-time
June 2014
@toddlmontgomery
Request Response Delay Delay Processing
@toddlmontgomery
image courtesy www.tensator.com
@toddlmontgomery
@toddlmontgomery
“OK” Bandwidth + Long RTT + High Loss Rate + No Effective HTTP Pipelining
http://en.wikipedia.org/wiki/HTTP_pipelining
@toddlmontgomery
@toddlmontgomery
Request ACK Response ACK
…
But… Async Request/Response… kinda
Event Event
http://en.wikipedia.org/wiki/List_of_web_service_specifications
No, seriously, lots of these!!
@toddlmontgomery
@toddlmontgomery
“Yeah, yeah, but your scientists were so preoccupied with whether
stop to think if they should.” — Jurassic Park
Just because you could use HTTP, doesn’t mean you should…
@toddlmontgomery
http://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol
"there is a strong, dark, rich requirement for a protocol designed espressoly [sic] for the brewing of coffee"
@toddlmontgomery
@toddlmontgomery
418 I’m a teapot BREW WHEN
"This has a serious purpose – it identifies many of the ways in which HTTP has been extended inappropriately.” — Larry Masinter, author http://larry.masinter.net/
@toddlmontgomery
@toddlmontgomery
@toddlmontgomery
Request Response
@toddlmontgomery
Persistent connections help a LOT! Well designed protocols help a LOT MORE! Many simultaneous connections hurt! Using the wrong protocol with the wrong pattern hurts A LOT!
Stay out of High Energy State!
@toddlmontgomery
@toddlmontgomery
RFC 6455
Events Events 1 1 S w i t c h HTTP Upgrade
https://tools.ietf.org/html/rfc6455
@toddlmontgomery
IETF Drafts
Multiple Streams Efficient Headers (HPACK) Binary Encoding
Events Events
http://www.ietf.org/id/draft-ietf-httpbis-http2-12.txt
@toddlmontgomery
IETF Draft
Events Events
http://www.ietf.org/id/draft-hirano-httpbis-websocket-over-http2-00.txt
@toddlmontgomery
http://mqtt.org/
Lightweight Publish/Subscribe Messaging Transport Runs over TCP
MQTT-SN for non-TCP /IP Broker-Based
OASIS Standard
@toddlmontgomery
http://www.ietf.org/id/draft-ietf-core-coap-18.txt
Runs over UDP , DTLS,
Request/Response (either direction), Publish/Subscribe Standardized HTTP Mapping Resource Discovery, Linking, etc.
IETF CoRE WG (Constrained RESTful Environments)
@toddlmontgomery
Sustain REST Principles Standards-Based Easily Parsed Efficient Handling of Data/Metadata Flexible - Easily Extended Easy to Implement
@toddlmontgomery
WebSocket + MQTT HTTP/2 WebSocket + CoAP WebSocket + HPACK
Combining IoT & REST
@toddlmontgomery
Nothing Optional, TLS, HPACK, etc. Familiar Primitives More complex than HTTP /1.1 Ecosystems: REST Yes, IoT No
@toddlmontgomery
HTTP Mapping? WebSocket can adapt Some Guaranteed Messaging Semantics Ecosystems: IoT Yes, REST No (w/o WS) Enables Many Patterns
@toddlmontgomery
http://www.ietf.org/id/draft-ietf-httpbis-header-compression-07.txt
HPACK handles method + headers Use header for Stream ID Not a Standard, but made of Standards HPACK is (subjectively) complex
@toddlmontgomery
http://www.ietf.org/id/draft-savolainen-core-coap-websockets-02.txt
HTTP Mapping Ecosystems: REST Yes, IoT Yes No Guaranteed Messaging Not Broker-based, Peer-to-Peer
@toddlmontgomery
@toddlmontgomery
Thing 1 Thing 2
Not a human Also, …not a human Does not need to be human readable
http://tools.ietf.org/html/rfc7049
Concise Binary Object Representation (COBR) FIX / Simple Binary Encoding (SBE)
https://github.com/real-logic/simple-binary-encoding
HPACK (Part of HTTP /2)
@toddlmontgomery