Evolving REST for an IoT World Todd L. Montgomery @toddlmontgomery
Representational State Transfer http://en.wikipedia.org/wiki/Representational_state_transfer @toddlmontgomery
pro·to·col noun \ ˈ pr ō -t ə - ˌ k o ̇ l, - ˌ k ō l, - ˌ käl, -k ə l\ � ... � 3 b : a set of conventions governing the treatment and especially the 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
Stateless Client - Server Cacheable @toddlmontgomery
Uniform Interface Hypermedia, Resources, URIs Layered Hmmm… @toddlmontgomery
REST Ecosystem @toddlmontgomery
Tools - CLI JSON HTTP/1.1,TCP, [TLS/SSL], IP Fast, Easy Integration Browser @toddlmontgomery
IoT/IoE Ecosystem @toddlmontgomery
Application HTTP/1.1 MQTT TLS/SSL? TCP Boards & Kits JSON IP ?? App App? SCADA Bluetooth Evolving Rapidly Multiple Stacks Environments @toddlmontgomery
Publish/Subscribe Request/Response Request/Response Communication Patterns Streaming “Ingest” @toddlmontgomery
History & Evolution @toddlmontgomery
HTTP RFC 2068, 2616, …, 7230-7240 June 2014 Request Event Bi-Directional… kinda, … only but… one direction at-a-time Event Response Synchronous Request/Response @toddlmontgomery
HTTP Request What happens Delay here while waiting? Processing Delay …Nothing… Response Stop-and-Wait @toddlmontgomery
Head-Of-Line Blocking image courtesy www.tensator.com @toddlmontgomery
Latency Sensitivity @toddlmontgomery
Mobile “OK” Bandwidth + Long RTT + High Loss Rate + No Effective HTTP Pipelining Truly Awful User Experiences http://en.wikipedia.org/wiki/HTTP_pipelining @toddlmontgomery
Asynchronous Request / Response Unlock More Reactive Patterns! @toddlmontgomery
Web Services http://en.wikipedia.org/wiki/List_of_web_service_specifications Request No, seriously , lots of these!! Sync Event Request ACK … Response Sync Event Response ACK But… Async Request/Response… kinda @toddlmontgomery
Thankfully, Locked within the Enterprise… Mostly… @toddlmontgomery
Just because you could use HTTP, doesn’t mean you should … “Yeah, yeah, but your scientists were so preoccupied with whether or not they could that they didn't stop to think if they should .” — Jurassic Park Philosophy of some REST APIs @toddlmontgomery
HTCPCP RFC 2324, Extended by RFC 7168 "there is a strong, dark, rich requirement for a protocol designed espressoly [sic] for the brewing of coffee" http://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol @toddlmontgomery
@toddlmontgomery
BREW WHEN 418 I’m a teapot "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
Tooling Addressing Easy firewall traversal Why is HTTP used? Works with Anything Simple, Flexible, Familiar @toddlmontgomery
Publish/Subscribe Request/Response Request/Response Communication Patterns Streaming “Ingest” @toddlmontgomery
User State Security Query (Challenge) Request Response Keep-Alive Support or Watchdog (UI/Device) @toddlmontgomery
Persistent connections help a LOT! Well designed protocols help a LOT MORE! Stay out of High Battery Life Energy State! Many simultaneous connections hurt! Using the wrong protocol with the wrong pattern hurts A LOT! The Wrong Patterns Hurt a LOT! @toddlmontgomery
New Protocols & Standards @toddlmontgomery
WebSocket RFC 6455 HTTP Upgrade Really a Async Transport Request/ Protocol Response h c t i w S 1 0 1 Events Events Ingest Streaming Full Duplex, Asynchronous “TCP over the Web” https://tools.ietf.org/html/rfc6455 @toddlmontgomery
SPDY & HTTP/2 IETF Drafts Async Request Events Events Async Response Async Request/Response Multiple Streams Efficient Headers (HPACK) Binary Encoding http://www.ietf.org/id/draft-ietf-httpbis-http2-12.txt @toddlmontgomery
WebSocket over HTTP/2 IETF Draft Async Async Response Request Events Events Ingest Streaming Full Duplex, Asynchronous with Multiple Channels/Streams http://www.ietf.org/id/draft-hirano-httpbis-websocket-over-http2-00.txt @toddlmontgomery
Runs over TCP Broker-Based or WebSocket (v3.1.1) MQ Telemetry Transport (MQTT) OASIS Standard Lightweight MQTT-SN for non-TCP /IP Publish/Subscribe Messaging Transport http://mqtt.org/ @toddlmontgomery
Standardized HTTP Runs over UDP , DTLS, Mapping or WebSocket Constrained Application Protocol (CoAP) IETF CoRE WG (Constrained RESTful Environments) Request/Response Resource Discovery, (either direction), Linking, etc. Publish/Subscribe http://www.ietf.org/id/draft-ietf-core-coap-18.txt @toddlmontgomery
Sustain REST Principles Easily Parsed Standards-Based Requirements Easy to Implement Flexible - Easily Extended Efficient Handling of Data/Metadata @toddlmontgomery
HTTP/2 WebSocket + MQTT Possible Game Plan(s) Combining IoT & REST WebSocket + CoAP WebSocket + HPACK @toddlmontgomery
Nothing Optional, More complex TLS, HPACK, etc. than HTTP /1.1 HTTP/2 Ecosystems: Familiar Primitives REST Yes, IoT No @toddlmontgomery
Ecosystems: HTTP Mapping? IoT Yes, WebSocket can adapt REST No (w/o WS) WebSocket + MQTT Some Guaranteed Enables Many Messaging Semantics Patterns @toddlmontgomery
Not a Standard, HPACK handles but made of method + headers Standards WebSocket + HPACK HPACK is Use header for (subjectively) Stream ID complex http://www.ietf.org/id/draft-ietf-httpbis-header-compression-07.txt @toddlmontgomery
Not Broker-based, HTTP Mapping Peer-to-Peer WebSocket + CoAP Ecosystems: No REST Yes, Guaranteed IoT Yes Messaging http://www.ietf.org/id/draft-savolainen-core-coap-websockets-02.txt @toddlmontgomery
One More Thing… � JSON @toddlmontgomery
Does not need to be human readable Thing 1 Thing 2 Not a human Also, …not a human Binary Encoding Concise Binary Object Representation (COBR) FIX / Simple Binary Encoding (SBE) HPACK (Part of HTTP /2) http://tools.ietf.org/html/rfc7049 https://github.com/real-logic/simple-binary-encoding @toddlmontgomery
Questions? Kaazing http://www.kaazing.com • Slideshare http://www.slideshare.com/toddleemontgomery • Twitter @toddlmontgomery • Thank You! @toddlmontgomery
Recommend
More recommend