real time web: is there a life without socket.io and node.js?
DESCRIPTION
A small overview of possible solutions for making real-time web in context of client (server is a black box)TRANSCRIPT
![Page 1: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/1.jpg)
Real-time webIS THERE A LIFE WITHOUT SOCKET.IO AND NODE.JS?
![Page 2: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/2.jpg)
2
Who am I Eduard Trayan Software developer at EPAM Systems Zend PHP 5.3 Certified developer SensioLabs Certified Symfony Developer [email protected]
![Page 3: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/3.jpg)
3
Agenda Say some words about real-time web Do small overview about possible solutions And play game
![Page 4: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/4.jpg)
4
Real-time web
![Page 5: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/5.jpg)
5
What is the real-time web?
![Page 6: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/6.jpg)
6
Real-time web Set of technologies and practices Receiving information as soon as possible Users doesn't need to check updates http://en.wikipedia.org/wiki/Real-time_web
![Page 7: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/7.jpg)
7
Main principles – push instead of pull
![Page 8: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/8.jpg)
8
Main principles – ASAP
![Page 9: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/9.jpg)
9
Where to find a use?
![Page 10: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/10.jpg)
10
Where to find a use?
![Page 11: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/11.jpg)
11
Solutions
![Page 12: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/12.jpg)
12
Possible solutions
Proprietary solutions
Comet
Ajax polling
WebSockets
![Page 13: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/13.jpg)
13
Proprietary solutions
![Page 14: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/14.jpg)
14
Proprietary solutions
Adobe Flash
Java applet
Microsoft Silverlight
![Page 15: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/15.jpg)
15
Comet
![Page 16: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/16.jpg)
16
What is the comet?
![Page 17: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/17.jpg)
17
Comet is not a cleaner
![Page 18: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/18.jpg)
18
Comet is not a solar system body
![Page 19: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/19.jpg)
19
Comet Web application model Long-held HTTP requests Server push datahttp://en.wikipedia.org/wiki/Comet_(programming)
![Page 20: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/20.jpg)
20
CometAjax long pollingForever iframeActiveXObject htmlfileServer sent eventsXMLHTTPRequest interactive stateJSONP long polling
![Page 21: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/21.jpg)
21
Ajax long polling - algorithm
![Page 22: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/22.jpg)
22
Ajax long polling - opportunities
Cross-domain requests
Unidirectional communications between client and server
Binary or text data
Or the same opportunities as provided by XMLHTTPRequest
![Page 23: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/23.jpg)
23
Ajax long polling - disadvantagesBig delay between event and notification
Big number of requests
Big incoming traffic
Caching by browsers
Possible problems with proxy
![Page 24: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/24.jpg)
24
What solution does facebook use for chat?
1. Ajax long polling2. WebSockets3. Forever iframe4. Proprietary solutions
![Page 25: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/25.jpg)
25
Forever iframe - algorithm
![Page 26: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/26.jpg)
26
Forever iframe - opportunities
Cross-domain requests
POST requests
Unidirectional communications between client and server
![Page 27: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/27.jpg)
27
Forever iframe - disadvantagesLoad indication
Script buffering
Page buffering
Proxy buffering
Impossible to compress data
Changes in browser’s history
Hard to detect disconnections/errors
![Page 28: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/28.jpg)
28
What solution does vk.com use for chat?1. WebSockets2. JSONP long polling3. Ajax long polling4. Proprietary solutions
![Page 29: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/29.jpg)
29
ActiveXObject - algorithm
![Page 30: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/30.jpg)
30
ActiveXObject - opportunities
Cross-domain requests
POST requests
Unidirectional communications between client and server
![Page 31: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/31.jpg)
31
ActiveXObject - disadvantagesIE only
Script buffering
Page buffering
Proxy buffering
Impossible to compress data
Changes in browser’s history
Hard to detect disconnections/errors
![Page 32: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/32.jpg)
32
What solution does vseti.by use for chat?1. Forever iframe2. Proprietary solutions3. ActiveXObject htmlfile4. Ajax long polling
![Page 33: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/33.jpg)
33
SSE - algorithm
![Page 34: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/34.jpg)
34
SSE - opportunitiesMultiline messages
Cross-domain requests
Unidirectional communications between client and server
Custom events
Automatic reconnect
Error handling
Control of events
![Page 35: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/35.jpg)
35
SSE - disadvantagesDoesn’t work in IE
Doesn’t work in android browsers <4.4
Impossible to compress data
![Page 36: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/36.jpg)
36
What solution does assistent.by use?1. Forever iframe2. Proprietary solutions3. ActiveXObject htmlfile4. Ajax long polling
![Page 37: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/37.jpg)
37
XMLHTTPRequest interactive state -algorithm
![Page 38: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/38.jpg)
38
XMLHTTPRequest interactive state -opportunitiesCross-domain requests
Unidirectional communications between client and server
Binary or text data
Or the same opportunities as provided by XMLHTTPRequest
![Page 39: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/39.jpg)
39
XMLHTTPRequest interactive state -disadvantages
Doesn’t work at <IE10
Unsupported by mobile browsers
Impossible to compress data
![Page 40: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/40.jpg)
40
What solution does flowdock use for chat?1. Forever iframe2. Proprietary solutions3. WebSockets4. Ajax long polling
![Page 41: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/41.jpg)
41
JSONP long polling - algorithm
![Page 42: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/42.jpg)
42
JSONP long polling - opportunities
Cross-domain requests
Unidirectional communications between client and server
![Page 43: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/43.jpg)
43
JSONP long polling - specifics
Handling errors with callback/onload/onerror/onreadystatechange
Sending callback name in request
![Page 44: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/44.jpg)
44
JSONP long polling - disadvantagesBig delay between event and notification
Big number of requests
Big incoming traffic
![Page 45: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/45.jpg)
45
Ajax polling
![Page 46: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/46.jpg)
46
Ajax polling - algorithm
![Page 47: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/47.jpg)
47
Ajax polling - opportunities
Cross-domain requests
Unidirectional communications between client and server
Binary or text data
Or the same opportunities as provided in XMLHTTPRequest
![Page 48: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/48.jpg)
48
Ajax polling - disadvantagesBig delay between event and notification
Big number of requests
Big incoming traffic
Caching by browsers
![Page 49: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/49.jpg)
49
WebSockets
![Page 50: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/50.jpg)
50
WebSocket - algorithm
![Page 51: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/51.jpg)
51
WebSocket - opportunities
Bidirectional communications between client and server
Cross-domain requests
Binary or text data
Usage of extensions and subprotocols
![Page 52: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/52.jpg)
52
WebSocket - disadvantagesDoesn’t work at <IE10, android browsers <4.4, iOS Safary <6.0, Safary <6
Possible problems with proxy
![Page 53: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/53.jpg)
53
Useful tools
http://caniuse.com/
http://crossbrowsertesting.com/
http://www.browserstack.com/
![Page 54: Real time web: is there a life without socket.io and node.js?](https://reader035.vdocument.in/reader035/viewer/2022062319/5565cbacd8b42a5b488b52cd/html5/thumbnails/54.jpg)
54
Questions?