Successfully reported this slideshow.

Real-Time Web APIs

4

Share

1 of 10
1 of 10

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Real-Time Web APIs

  1. 1. Real-TimeWeb APIs Ryan J. McDonough @damnhandy | http://damnhandy.com
  2. 2. Options Protocols • Long-Polling • PubSubHubbub • WebHooks • WebSockets • Server-Sent Events Services • Pusher • Kaazing • PubNub
  3. 3. Promising Directions • PubSubHubbub • Server-Sent Events (SSE) • WebSockets + “Something Else”
  4. 4. PubSubHubbub
  5. 5. WebSockets • STOMP +WebSockets is an interesting idea • No ideal way for indicating the sub-protocol used by theWebSocket • No way to express what media type is coming over the wire • Not sure bi-direction communication is necessary
  6. 6. Server-Sent Events Connection: keep-alive Content-Type: text/event-stream Date: Sat, 21 Sep 2013 13:31:59 GMT data: {"msg": "First message"}nn event: userlogonn data: {"username": "John123"}nn event: updaten data: {"username": "John123", "emotion": "happy"}nn
  7. 7. WhatWould Browser Do? <script> var source = new EventSource(’/updates'); source.addEventListener('add', addHandler, false); </script>
  8. 8. WhatWould PSHB Do? Link: <http://example.com/events>; rel=”hub";
  9. 9. Ideas: Links for SSE Link: <http://example.com/events>; rel="notifications"; type="text/event-stream;data='application/ld+json'";
  10. 10. Links forWebSockets + “Something” Link: <ws://example.com/events>; rel=”websocket/something"; type=“application/ld+json";

Editor's Notes

  • The browser typically gets code
  • ×