• Like
Real-time APIs
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Real-time APIs


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.

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
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    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


  • 1. Real-time APIs and how to build one@rossmason, @mulesoft
  • 2. Agenda• What the heck is Real-time APIs• The technology and trends• Demos
  • 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. 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. Why Real-time?• User experience: Don’t make people wait• Accuracy: Don’t make things wait• Because life happen in real-time
  • 6. Why Real-time?Speed
  • 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. Why Real-time?Broadcast
  • 9. Why Real-time?Engagement
  • 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. 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. REST or Real-time? consumer REST API Streaming APIResource A Resource B Resource C Transport Subscription Manager Query Processor
  • 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. 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. Real-time APIs: REST + JSON or XML 1% of all APIs support real-time interaction source: ProgrammableWeb.com
  • 16. Stop. Demo time!
  • 17. Demo 1: AJAX Streaming API HTTP Long Transport Polling Subscription CometD Manager Query <None> Processorhttps://github.com/rossmason/mule-streaming-api-demo
  • 18. Demo 2: WebSockets Streaming API Transport WebSocket Subscription JMS Manager Query Esper Processorhttps://github.com/rossmason/mule-streaming-api-demo
  • 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. 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. 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