We know interactivity is the key to keep our user's interest alive but we can't reduce animation to UI anymore. Twitter, Waze, Slack... users are used to have real-time data in applications they love.
But how can you turn your static API into a stream of data? By pulling? Pushing? Webhook-ing? When talking about data streaming, we often think about WebSockets. But have you ever heard of Server-Sent Events?
In this talk, we will compare those technologies to understand which one you should opt for depending on your usecase and I'll show you how we have been even further by reducing the amount of data to transfer with JSON-Patch.
And because real-time data is not only needed by web (and because it's much more fun), I'll show you how we can make drone dance on streamed APIs.
21. @StreamdataIOstreamdataio
✓ Define a callback URL ✓ Create a subscription endpoint
- GET /webhook
- POST /webhook
- GET /webhook/{id}
- PUT /webhook/{id}
- DELETE /webhook/{id}
TODO LIST
Consumer API Provider
✓ Implement your webhook queue
- inline HTTP Requests
- SQL-based queue
- AMQP broker
- batch
24. PROS AND CONS
@StreamdataIOstreamdataio
✓ Real-Time updates
✓ Easily consumed
✓ Without dedicated resources
✓ Poor user experience
✓ Does not work with all clients
✓ Manual setup✓ Easily integrated
✓ Debugging
✓ (almost) Real-Time updates
32. @StreamdataIOstreamdataio
SUBSCRIBE - SUBSCRIBERS 1/2
Subscribers Send subscription request to the Hub
POST https://my-hub.com/
…
hub.mode="subscribe"
hub.topic="https://my-resource.com/"
hub.callback="http://example.com/callback"
hub.secret="my-token"
33. @StreamdataIOstreamdataio
SUBSCRIBE - HUB
Hub Verify intent of the subscribers
GET http://example.com/callback
…
hub.mode="subscribe"
hub.topic="https://my-resource.com/"
hub.challenge="a random string"
hub.lease_seconds=86400
40. @StreamdataIOstreamdataio
UNSUBSCRIBE - SUBSCRIBERS 1/2
Subscribers Send unsubscription request to the Hub
POST https://my-hub.com/
…
hub.mode="unsubscribe"
hub.topic="https://my-resource.com/"
hub.callback="http://example.com/callback"
hub.secret="my-token"
41. @StreamdataIOstreamdataio
UNSUBSCRIBE - HUB
Hub Verify intent of the subscribers
GET http://example.com/callback
…
hub.mode="unsubscribe"
hub.topic="https://my-resource.com/"
hub.challenge="a random string"
43. PROS AND CONS
@StreamdataIOstreamdataio
✓ (almost) Real-Time updates
✓ Easily consumed
✓ Without dedicated resources
✓ Poor user experience
✓ Does not work with all clients
✓ Manual setup✓ Easily integrated
✓ Debugging
✓ Need another call to get data
58. Proxy-as-a-Service
✓ works with any JSON API
✓ streaming based on Server-Sent Events
✓ dynamic cache
✓ incremental updates
STREAMDATA.IO
@StreamdataIOstreamdataio