web communication

35
Web Communication [email protected]

Upload: adrian-olaru

Post on 05-Jul-2015

549 views

Category:

Technology


1 download

DESCRIPTION

Web Messaging, Web Workers, Server Sent Events, Web Sockets

TRANSCRIPT

Page 2: Web Communication
Page 3: Web Communication

Connectivity

Page 4: Web Communication

Web Messaging

Web Workers

Server Sent Events

Web Sockets

Page 5: Web Communication

The way of the force

Page 6: Web Communication

Sending complex data

Page 7: Web Communication

Don’t trust client e.data

Always check e.origin

Page 8: Web Communication

allows documents from different domains to communicate with each other in a secure way

Web Messaging

Page 9: Web Communication

Browser Support*

5.0+

3.0+

8.0

4.0+

10.1+

* source: http://caniuse.com

Page 10: Web Communication
Page 11: Web Communication
Page 12: Web Communication

Use Cases

portals

widgets

ads

traffic counters

Page 13: Web Communication

Web Workersrun JavaScript in parallel on a web page, without

blocking the user interface

Page 14: Web Communication

Browser Support*

5.0+

3.5+

4.0+

10.6+

* source: http://caniuse.com

Page 15: Web Communication
Page 16: Web Communication
Page 17: Web Communication

Notes

can’t access parent & it’s DOM

‘this’ == current worker

can use XHR, SSE or WebSocket

can importScripts(‘script.js’)

can use other workers

can use timers (setTimeout, setInterval)

Page 18: Web Communication

Server Sent Eventspush data from the server to the client over HTTP

Page 19: Web Communication

Browser Support*

6.0+

4.0

5.0

11

* source: http://caniuse.com

Page 20: Web Communication
Page 21: Web Communication
Page 22: Web Communication
Page 23: Web Communication
Page 24: Web Communication
Page 25: Web Communication

Use Cases

subscribe to live score

real time polls

bidding updates for actions

stock quotes

live news

Page 26: Web Communication

Web Socketsa bi-directional connection between the server and the

client

Page 27: Web Communication

Browser Support*

5.0+

4.0

5.0

11

* source: http://caniuse.com

deactivated by default

*

*

*

Page 28: Web Communication
Page 29: Web Communication
Page 30: Web Communication
Page 31: Web Communication

Notes

full duplex communication

removes the overhead (only 2 bytes)

dramatically reduces complexity

Page 32: Web Communication

Use Cases

online chat

online games

realtime geolocation

package tracking

Page 33: Web Communication

Demoshttp://github.com/adrianolaru/webcom

Page 34: Web Communication
Page 35: Web Communication

Danke