Streamdata.io
Efficiently Turn APIs into Real-time Experiences
BreizhCamp 2016
#BzhCmp
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
proxies and load balancers reconfiguration
No need to reconfigure!
(it's HTTP)
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);
Use case: Préchargement de 500 Tweets sur une page web (nginx configuré en tant que proxy)
Fintech / Trading
Betting
Games
Realtime timetables
Animated data apps (charts, monitoring, etc.)
etc.
(*) WebRTC might be even more suitable
Merci à Gregory Houllier pour l'utilisation du thème BreizhCamp avec revealjs
By Streamdata.io
WebSockets and Server-Sent Events. Why? How?