0
Real-time APIs and how to build one@rossmason, @mulesoft
Agenda• What the heck is Real-time APIs• The technology and trends• Demos
What is real-time?• Real-time: the ability to react to something as  soon as it happens• Web real-time: Same but slower (a...
What is a real-time API?• Real-time API: Allows an app to only register  for events that it is interested in  – Give me ne...
Why Real-time?• User experience: Don’t make people wait• Accuracy: Don’t make things wait• Because life happen in real-time
Why Real-time?Speed
What do most API consumers do?• Polling  – Make a request every 60 seconds  – 61.672% of calls yield no result  – New data...
Why Real-time?Broadcast
Why Real-time?Engagement
Push vs StreamingPush (aka WebHooks)                  Streaming• I’ll call you back                 • Keep the line open• ...
REST or Real-time?• Real-time APIs are additive to an existing REST  or SOAP API• Invocation semantics are different  – Cl...
REST or Real-time?             consumer              REST API                 Streaming APIResource A   Resource B   Resou...
Real-time Technologies• Transport   – Comet (HTTP)   – WebSocket (HTTP)• Protocols   – With formal pub/sub semantics:     ...
Real-time APIs are realAPI                     Real-time technology/protocolSalesforce              CometFacebook         ...
Real-time APIs: REST + JSON or XML 1% of all APIs support real-time interaction                                 source: Pr...
Stop. Demo time!
Demo 1: AJAX                                   Streaming API                                                       HTTP Lo...
Demo 2: WebSockets                                   Streaming API                                     Transport         W...
Mule real-time API supportTechnologies      3rd Party APIs• CometD          • Salesforce Streaming API• Web Sockets     • ...
Real-time Web SotN• Still in early adopter territory   – But some major APIs use this approach• Limitations   – No discove...
Thank You!• Twitter: @rossmason, @mulesoft• Slides: http://slideshare.net/rossmason• Code: https://github.com/rossmason/mu...
Upcoming SlideShare
Loading in...5
×

Real-time APIs

6,146

Published on

The number of real-time APIs on the Web are rising. What are real-time APIs, how are they used? How are they built? This deck and demo was presented at InfoQ in San Francisco Nov 2012.

Published in: Technology, Business
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,146
On Slideshare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
58
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide
  • Creator of the Mule project: first open source ESBFounder the company behind Mule and its family of productsSit firmly in the love marmite campStarted my career working in banks, telco and insuranceI have always been a “plumber” 14 years experience hooking stuff togetherUltimately I’m a geek that likes to tinker with softwareHuge lego fan, obsessed as a kid. Family guy cracks me up – my wife does notget either one
  • Simple. Because nobody wants to waitBecause your customers expect it. The world expects itReal-time will make or break your application- (Think about the Apps you use (maybe use Cue as an example))
  • “Don’t call us, we will call you”Need to work within the boundaries of API rate limits How many calls per hour\\ Total calls per day Time between callsList examples:
  • We don’t like to wait. Speed is a massive factor of success for any No point learning about something 4 minutes after it happened
  • Transcript of "Real-time APIs"

    1. 1. Real-time APIs and how to build one@rossmason, @mulesoft
    2. 2. Agenda• What the heck is Real-time APIs• The technology and trends• Demos
    3. 3. What is real-time?• Real-time: the ability to react to something as soon as it happens• Web real-time: Same but slower (about 900ms delay is ok)
    4. 4. What is a real-time API?• Real-time API: Allows an app to only register for events that it is interested in – Give me new customers as they are added – Tell me when the stock price changes – Tell me in 4 weeks to send an email to Bob
    5. 5. Why Real-time?• User experience: Don’t make people wait• Accuracy: Don’t make things wait• Because life happen in real-time
    6. 6. Why Real-time?Speed
    7. 7. What do most API consumers do?• Polling – Make a request every 60 seconds – 61.672% of calls yield no result – New data can be available and waiting for 59.9 seconds – Need to work within the boundaries of API rate limits • How many calls per hour • Total calls per day • Time between calls
    8. 8. Why Real-time?Broadcast
    9. 9. Why Real-time?Engagement
    10. 10. Push vs StreamingPush (aka WebHooks) Streaming• I’ll call you back • Keep the line open• Asynchronous • Request Response• Drawbacks • Drawbacks – Need to have a reply channel – Holds a socket connection setup open – Continuations can be – Considered a security risk by used some – Harder to implement durable – Reliability complicated – did connections the data arrive
    11. 11. REST or Real-time?• Real-time APIs are additive to an existing REST or SOAP API• Invocation semantics are different – Client needs to handle two invocation models• Real-time APIs are mostly used to query data – Usually not to perform CRUD operations• Have different SLA and reliability requirements
    12. 12. REST or Real-time? consumer REST API Streaming APIResource A Resource B Resource C Transport Subscription Manager Query Processor
    13. 13. Real-time Technologies• Transport – Comet (HTTP) – WebSocket (HTTP)• Protocols – With formal pub/sub semantics: • XMPP • Bayeux • STOMP – Ad hoc, ie "subscription" expressed in the request: • JSON• Push – PubSubHubbub – Web Hooks
    14. 14. Real-time APIs are realAPI Real-time technology/protocolSalesforce CometFacebook PubSubHubbubInstagram Ah Hoc (WebHooks/PubSubHubbub)Twitter Ad Hoc (Comet)PubNub Ad HocSuperFeedr XMPPPusher Ad Hoc (WebSockets)
    15. 15. Real-time APIs: REST + JSON or XML 1% of all APIs support real-time interaction source: ProgrammableWeb.com
    16. 16. Stop. Demo time!
    17. 17. Demo 1: AJAX Streaming API HTTP Long Transport Polling Subscription CometD Manager Query <None> Processorhttps://github.com/rossmason/mule-streaming-api-demo
    18. 18. Demo 2: WebSockets Streaming API Transport WebSocket Subscription JMS Manager Query Esper Processorhttps://github.com/rossmason/mule-streaming-api-demo
    19. 19. Mule real-time API supportTechnologies 3rd Party APIs• CometD • Salesforce Streaming API• Web Sockets • Facebook real-time API• Ad Hoc • Twitter Firehose• PubSubHubbub • PubNub• XMPP• STOMP• WebHooks
    20. 20. Real-time Web SotN• Still in early adopter territory – But some major APIs use this approach• Limitations – No discovery protocol (i.e. WADL) – Many different methods • Some hampered by older browser technology (i.e. Web Sockets
    21. 21. Thank You!• Twitter: @rossmason, @mulesoft• Slides: http://slideshare.net/rossmason• Code: https://github.com/rossmason/mule-streaming-api-demo• Blog: http://blogs.mulesoft.org• We are hiring: http://mulesoft.com.careers
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×