Streamdata.io
Efficiently Turn APIs into Real-time Experiences
NCrafts 2016
#ncrafts
#ncrafts @ctranxuan
#ncrafts
@ctranxuan
#ncrafts @ctranxuan
GET /chat HTTP/1.1
Host: example.com:8000
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
GET /stream HTTP/1.1 1
Host: example.com
Accept: text/event-stream
#ncrafts @ctranxuan
proxies and load balancers reconfiguration
No need to reconfigure!
(it's HTTP)
#ncrafts @ctranxuan
#ncrafts @ctranxuan
#ncrafts
#ncrafts @ctranxuan
3237 | 200 | 128 | 2970 | 900 |
---|---|---|---|---|
6 | 6 | 8 | 6 | 6 |
---|---|---|---|---|
HTTP
SSE
var websocket =
new WebSocket('ws://mywebso/echo');
websocket.onopen = function () {
...
};
websocket.onmessage = function (e) {
...
};
websocket.onerror = function (error) {
...
};
var eventSource =
new EventSource('http://mysse/echo');
eventSource.onopen = function () {
...
};
eventSource.onmessage = function (e) {
...
};
eventSource.onerror = function (error) {
...
};
source.addEventListener('foo', function(e) {
...
}, false);
#ncrafts @ctranxuan
#ncrafts @ctranxuan
Use case: fetch 500 Tweets for a web page (nginx configured as a proxy)
#ncrafts @ctranxuan
Fintech / Trading
Betting
Games
Realtime timetables
Animated data apps (charts, monitoring, etc.)
etc.
(*) WebRTC might be even more suitable
#ncrafts @ctranxuan
#ncrafts @ctranxuan
#ncrafts @ctranxuan
#ncrafts @ctranxuan
#ncrafts @ctranxuan
By Streamdata.io
WebSockets and Server-Sent Events. Why? How?