real time web

71

Upload: dingding-ye

Post on 24-May-2015

2.837 views

Category:

Technology


1 download

DESCRIPTION

The talk I did at 2012 Ruby Conf China. Introduction to real time web, solutions and how to choose different solution for different site.

TRANSCRIPT

Page 1: Real time web
Page 2: Real time web

http://www.wired.com/images_blogs/gadgetlab/2011/05/google_io_f.jpg

Page 3: Real time web
Page 4: Real time web

Nice to meet you!

叶玎玎[email protected]

https://github.com/sishen

@yedingding

@yedingdinghttp://weibo.com/presently

Page 5: Real time web

https://pragmatic.ly

Page 6: Real time web

Let’s Begin!

Page 7: Real time web

http://www.sneijers.net/wp-content/uploads/2011/12/web-150x150.jpghttp://www.lyngsat-logo.com/tvchannel/it/Real-Time.html

Page 8: Real time web

UX-driven evolution of Web

Page 9: Real time web

http://edudemic.com/wp-content/uploads/2012/07/future-400x300.jpg

Page 10: Real time web

What’s “Real Time”?

Page 11: Real time web

Show Me!

Page 12: Real time web

Instant Messaging

Page 13: Real time web

Apple Push Notification

Page 14: Real time web

Internet Game

http://s2.img.766.com/194/120217/1613/144125.jpg

Page 15: Real time web

Persistent Connection

Page 16: Real time web

Real Time in Web?

Page 17: Real time web

Persistent Connection

betweenBrower and Server

http://careers.accenture.com/Microsites/uk-graduate/PublishingImages/programmes/consulting/teach_first.jpg

Page 18: Real time web

But

Page 19: Real time web

Based on HTTP Protocol

Request - Response Protocol

Stateless Protocol

Page 20: Real time web

HTTP Protocol

Request - Response Protocol

Stateless Protocol

Page 21: Real time web

http://www.pdidevelopment.net/Images/picture/difficulty.jpg

Page 22: Real time web

Solutions

XHR Polling Long Polling HTTP Streaming Flash Socket WebSocket ….

Page 23: Real time web

XHR Polling

Page 24: Real time web

Long Polling

Page 25: Real time web

HTTP Streaming

Page 26: Real time web

Flash Socket

Page 27: Real time web

WebSocket

Page 28: Real time web

XHR Polling

LongPolling

HTTP Streaming

Flash Socke

t

WebSocket……

http://www.specialistpainphysio.com/wp-content/uploads/2012/08/thinking-pic.jpg

Page 29: Real time web

How to Choose?

Page 30: Real time web

Real Time Centric

Real Time Supplemental

VS

Page 31: Real time web

Real Examples

Page 32: Real time web

Pragmatic.ly

Page 33: Real time web

Pragmatic.ly

WebSocket XHR Polling Long Polling HTTP Streaming Flash Socket

Page 34: Real time web

Integration Fasthttp://thatimthing.com/wp-content/uploads/2011/02/HandsMovingFastOnKeyboard.jpg

Page 35: Real time web

Work Fast

http://www.devilslab.com/wp-content/uploads/2010/08/fast_snail_id86636_size350.jpg

Page 36: Real time web

Light Weighthttp://darkjade68.files.wordpress.com/2012/01/white-feather.jpg

Page 37: Real time web
Page 38: Real time web

SlangerOpen Source Pusher Server

Good for Dev

Page 39: Real time web

em-websocketEventMachine based

WebSocket Server

Page 40: Real time web

HipChat

Page 41: Real time web
Page 42: Real time web

HipChat

Long Polling XHR Polling HTTP Streaming Flash Socket WebSocket

Page 43: Real time web

BOSHBidirectional-Streams Over

Synchronous HTTP

Page 44: Real time web

https://upload.wikimedia.org/wikipedia/de/thumb/e/ea/Logo_XMPP_Standards_Foundation.svg/500px-Logo_XMPP_Standards_Foundation.svg.png

Page 45: Real time web

Easy to Scale

Page 46: Real time web

Easy to Extend

Page 47: Real time web

Works Everywhere

http://i.cmpnet.com/bmighty/images/slideshows/20090121/slide1A.jpg

Page 48: Real time web

Jabber Clients

Page 49: Real time web

RubyBOSH

Page 50: Real time web

stropherubylibstrophe.js

Page 51: Real time web
Page 52: Real time web

Twitter Web

Page 53: Real time web

Real Time is sugar

http://images.sciencedaily.com/2008/12/081210090819-large.jpg

Page 54: Real time web

Twitter Web

XHR Polling Long Polling HTTP Streaming Flash Socket WebSocket

Page 55: Real time web

http://www.dealz.ie/images/4347/original/simple.jpg

Page 56: Real time web

AcceptableSmart interval

Page 57: Real time web

Save Resource

Page 58: Real time web

Twitter Streaming API

Page 59: Real time web

Twitter Streaming API

HTTP Streaming XHR Polling Long Polling Flash Socket WebSocket

Page 60: Real time web
Page 61: Real time web

Low Overhead

Page 62: Real time web

Low Latency

Page 63: Real time web

API Friendly

Page 64: Real time web

RainbowThin

Page 65: Real time web

Rack::Stream

Page 66: Real time web

Weibo

Page 67: Real time web

Weibo Web

XHR Polling Long Polling HTTP Streaming Flash Socket WebSocket

Page 68: Real time web

Weibo IM

Long Polling XHR Polling HTTP Streaming Flash Socket WebSocket

Page 69: Real time web

Bayeux Protocol

Page 70: Real time web

Faye

Page 71: Real time web

Thank You!