SlideShare a Scribd company logo
Firebase introduction 
Kewang
2 
Live DEMO 
https://db.tt/40igKVhc
3 
Agenda 
● Variety of sync mechanisms 
● Firebase
Variety of sync mechanisms 
4
5 
Variety of sync mechanisms 
● Polling 
● Comet 
● Long Polling 
● WebSocket 
● Engine.IO (Socket.IO) 
● Polling & Push
6 
Polling 
send scheduling request
7 
Polling 
client server
8 
Polling 
client server 
T0 
T1 
T2
9 
Polling 
client server 
T0 
T1 
T2 
T4 
T5 
T6
10 
Polling 
client server 
T0 
T1 
T2 
T4 
T5 
T6 
T8 
T9 
T10
11 
Polling 
● Pros 
– Easy to implement 
● Cons 
– No efficiency
12 
Comet 
a never died HTTP request
13 
Comet 
client server
14 
Comet 
client server 
T0 
T1
15 
Comet 
client server 
T0 
T1
16 
Comet 
client server 
T0 
T1 
T3 
T2
17 
Comet 
client server 
T0 
T1 
T3 
T6 
T2 
T5
18 
Comet 
client server 
T0 
T1 
T3 
T6 
T8 
T2 
T5 
T7
19 
Comet 
client server 
T0 
T1 
T3 
T6 
T8 
T12 
T2 
T5 
T7 
T11
20 
Comet 
● Pros 
– Save more network traffic 
● Cons 
– Blocking IO issue 
– Always get server response, can't send another request
21 
Long Polling 
send a long time request repeatedly 
when response received
22 
Long Polling 
client server
23 
Long Polling 
client server 
T0 
T1
24 
Long Polling 
client server 
T0 
T1
25 
Long Polling 
client server 
T0 
T1 
T4 
T3
26 
Long Polling 
client server 
T0 
T1 
T4 
T3 
T5
27 
Long Polling 
client server 
T0 
T1 
T4 
T3 
T5
28 
Long Polling 
client server 
T0 
T1 
T4 
T3 
T5 
T21 
T20
29 
Long Polling 
● Pros 
– Save a little network traffic 
– Can send another request 
● Cons 
– I don't know
30 
WebSocket 
FDX communications channels 
over a single TCP connection
31 
WebSocket 
client server
32 
WebSocket 
client server
33 
WebSocket 
client server 
T0 
T1 
T2
34 
WebSocket 
client server 
T0 
T1 
T2 
T3 
T4 
T5
35 
WebSocket 
client server 
T0 
T1 
T2 
T3 
T4 
T5 
T9 
T10 
T11
36 
WebSocket 
client server 
T0 
T1 
T2 
T3 
T4 
T5 
T17 
T18 
T19 
T9 
T10 
T11
37 
WebSocket 
● Pros 
– Bidirectional communication 
– Save more network traffic 
● Cons 
– Proxy & Firewall issue
38 
Engine.IO 
communication layer for Socket.IO
39 
Engine.IO - Socket.IO history 
0.1~0.6.2 0.6.3~0.6.17 0.7.0~0.9.17 1.0.0~now 
websocket ✓ ✓ ✓ ✓ 
server-events ✓ 
flashsocket ✓ ✓ ✓ 
htmlfile ✓ ✓ 
xhr-multipart ✓ ✓ 
xhr-polling ✓ ✓ ✓ 
jsonp-polling ✓ 
polling ✓
40 
Engine.IO - Overview
41 
Engine.IO - Overview 
● Ensure the most reliable realtime communication
42 
Engine.IO - Overview 
● Ensure the most reliable realtime communication 
● Always establishes a long-polling connection first
43 
Engine.IO - Overview 
● Ensure the most reliable realtime communication 
● Always establishes a long-polling connection first 
– then tries to upgrade to better transports that are 
"tested" on the side
Engine.IO - Upgrade transport seamlessly 
44
Engine.IO - Upgrade transport seamlessly 
45 
● Switches from polling to another transport in 
between polling cycles
Engine.IO - Upgrade transport seamlessly 
46 
● Switches from polling to another transport in 
between polling cycles 
● To ensure no messages are lost, the upgrade packet 
will only be sent once all the buffers of the existing 
transport are flushed and the transport is 
considered paused
47 
Engine.IO 
client server
48 
Engine.IO 
client server 
T0 
T1
49 
Engine.IO 
client server 
T0 
T1
50 
Engine.IO 
client server 
T0 
T1
51 
Engine.IO 
client server 
T0 
T1 
T6 
T5 
T7
52 
Engine.IO 
client server 
T0 
T1 
T11 
T6 
T5 
T7 
T10
53 
Engine.IO 
client server 
T0 
T1 
T11 
T6 
T5 
T7 
T10
54 
Engine.IO 
client server 
T0 
T1 
T5 
T7 
T11 
T6 
T12 
T13 
T14 
T10
55 
Engine.IO 
● Pros 
– Auto-switch different network scenario 
● Cons 
– Use particular protocol at server & client
56 
Polling & Push 
simple sync mechanism
57 
Polling & Push - Push off 
client server
58 
Polling & Push - Push off 
client server 
T0 
T1 
T2
59 
Polling & Push - Push off 
client server 
T0 
T1 
T2 
T4 
T5 
T6
60 
Polling & Push - Push off 
client server 
T0 
T1 
T2 
T4 
T5 
T6 
T8 
T9 
T10
61 
Polling & Push - Push on 
client server SNS
62 
Polling & Push - Push on 
client server 
T0 
T1 
T2 
SNS
63 
Polling & Push - Push on 
client server 
T0 
T1 
T2 
T22 
T23 
T24 
SNS
64 
Polling & Push - Push on 
client server 
T0 
T1 
T2 
T22 
T23 
T24 
SNS 
T30
65 
Polling & Push - Push on 
client server 
T0 
T1 
T2 
T22 
T23 
T24 
T31 
T32 
T33 
SNS 
T30
66 
Polling & Push 
● Pros 
– Easy to implement 
● Cons 
– No (official statement)
67 
Firebase
68 
Firebase 
● Save data in the cloud 
● Realtime Data 
● Easy authentication 
● Bulletproof Security 
● Instant Scalability
69 
Pattern 1 - Client Only
70 
Pattern 1 - Client Only 
● Developing a brand new application 
● Needs minimal integration with legacy systems or 
other third party services 
● App doesn’t have heavy data processing needs or 
complex user authentication requirements
71 
Pattern 2 - Client & Server
72 
Pattern 2 - Client & Server 
● To integrate with third party APIs 
● Advanced authentication requirements 
● Can’t run computationally intensive code on a 
client, or requires code to run on a trusted server
73 
Pattern 3 - Existing App
74 
Pattern 3 - Existing App 
● An existing full-featured app, and aren’t planning a 
rewrite 
● Codebase is large and cannot change 
● Add realtime features without touching the rest of 
app
75 
Live DEMO2
76 
FAQ
77 
FAQ 
● Enterprise solution
78 
FAQ 
● Enterprise solution 
– Custom SLA 
– 24*7 support 
– Dedicated clusters 
– Training
79 
FAQ 
● Enterprise solution 
– Custom SLA 
– 24*7 support 
– Dedicated clusters 
– Training 
● Concurrent connection
80 
FAQ 
● Enterprise solution 
– Custom SLA 
– 24*7 support 
– Dedicated clusters 
– Training 
● Concurrent connection 
– Free plan has 50 max connections, otherwise is 
unlimited
81 
FAQ 
● Enterprise solution 
– Custom SLA 
– 24*7 support 
– Dedicated clusters 
– Training 
● Concurrent connection 
– Free plan has 50 max connections, otherwise is 
unlimited 
● Lock-in
82 
FAQ 
● Enterprise solution 
– Custom SLA 
– 24*7 support 
– Dedicated clusters 
– Training 
● Concurrent connection 
– Free plan has 50 max connections, otherwise is unlimited 
● Lock-in 
– Export data to JSON
83 
References 
● Browser 與 Server 持續同步的作法介紹 
● Comet (programming) 
● Engine.IO: the realtime engine 
● Engine.IO Protocol 
● How Firebase Works 
● Firebase Callbacks - what's the underlying trigger? 
● Firebase under the hood - watching web sockets in 
Chrome Developer Tools
84

More Related Content

What's hot (20)

PDF
F5 LTM Course by NIASTA Learning!
Niasta Learning
 
PDF
Ixiaexplorer
nlekh
 
PPTX
Free OpManager training Part 2 Monitoring Server Performance- season#3
ManageEngine, Zoho Corporation
 
PDF
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
Dheryta Jaisinghani
 
PPTX
Free OpManager training Part1- Discovery and classification season#3
ManageEngine, Zoho Corporation
 
PPTX
obs_virtual
Jerome Cain
 
PPTX
TCLSH and Macro Ping Test on Cisco Routers and Switches
NetProtocol Xpert
 
PPTX
VoLTE Testing Solution in NFV ecosystem
Debayan Chaudhuri
 
PPTX
Season 4 [Free OpManager training] Part2- Monitoring Server Performance
ManageEngine, Zoho Corporation
 
PPTX
Free OpManager training Part 4 - Monitoring Network Performance and Network Maps
ManageEngine, Zoho Corporation
 
PDF
Remote Console: Say goodbye to RDP
Антон Еремин
 
PDF
CAPsMANv2 | Wireless APs Controller by MikroTik
Dobri Boyadzhiev
 
PDF
Season 4 [Free OpManager training] Part3 - Monitoring Network Performance
ManageEngine, Zoho Corporation
 
PPT
Ixia presentation
Sasi Reddy
 
PDF
Denovo SIP VoIP Termination SBC Session Boarder Controler @ denofolab.com
Anne Kwong
 
PPTX
Network performance lessons from the coal face - Networkshop44
Jisc
 
PPTX
Free OpManager training Part 3 - Monitoring Network Performance and Network Maps
ManageEngine, Zoho Corporation
 
PPTX
SDN Project PPT
Matthew Chang
 
PPTX
Iot protocols tr 069
adorable73
 
PDF
Denovo SIP VoIP Termination SBC Session Boarder Controler @ denofolab.com
Anne Kwong
 
F5 LTM Course by NIASTA Learning!
Niasta Learning
 
Ixiaexplorer
nlekh
 
Free OpManager training Part 2 Monitoring Server Performance- season#3
ManageEngine, Zoho Corporation
 
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
Dheryta Jaisinghani
 
Free OpManager training Part1- Discovery and classification season#3
ManageEngine, Zoho Corporation
 
obs_virtual
Jerome Cain
 
TCLSH and Macro Ping Test on Cisco Routers and Switches
NetProtocol Xpert
 
VoLTE Testing Solution in NFV ecosystem
Debayan Chaudhuri
 
Season 4 [Free OpManager training] Part2- Monitoring Server Performance
ManageEngine, Zoho Corporation
 
Free OpManager training Part 4 - Monitoring Network Performance and Network Maps
ManageEngine, Zoho Corporation
 
Remote Console: Say goodbye to RDP
Антон Еремин
 
CAPsMANv2 | Wireless APs Controller by MikroTik
Dobri Boyadzhiev
 
Season 4 [Free OpManager training] Part3 - Monitoring Network Performance
ManageEngine, Zoho Corporation
 
Ixia presentation
Sasi Reddy
 
Denovo SIP VoIP Termination SBC Session Boarder Controler @ denofolab.com
Anne Kwong
 
Network performance lessons from the coal face - Networkshop44
Jisc
 
Free OpManager training Part 3 - Monitoring Network Performance and Network Maps
ManageEngine, Zoho Corporation
 
SDN Project PPT
Matthew Chang
 
Iot protocols tr 069
adorable73
 
Denovo SIP VoIP Termination SBC Session Boarder Controler @ denofolab.com
Anne Kwong
 

Viewers also liked (7)

PPTX
How to Build a Startup Team @ SLP Taipei
John Sie
 
PDF
Introducing Firebase by Google
Algiers Tech Meetup
 
PPTX
Firebase
TriState Technology
 
PDF
Introduction, Examples - Firebase
Eueung Mulyana
 
PPTX
Firebase - A real-time server
Aneeq Anwar
 
PDF
Introduction to Firebase from Google
Manikantan Krishnamurthy
 
PPTX
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
 
How to Build a Startup Team @ SLP Taipei
John Sie
 
Introducing Firebase by Google
Algiers Tech Meetup
 
Introduction, Examples - Firebase
Eueung Mulyana
 
Firebase - A real-time server
Aneeq Anwar
 
Introduction to Firebase from Google
Manikantan Krishnamurthy
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
 
Ad

Similar to Firebase introduction (20)

PDF
Real time web apps
Sepehr Rasouli
 
PDF
Real-Time with Flowdock
Flowdock
 
KEY
Realtime rocks
Vanbosse
 
PDF
Nodejs and WebSockets
Gonzalo Ayuso
 
PPTX
Best practices of building data streaming API
Constantine Slisenka
 
PDF
Real-Time Web Apps & Symfony. What are your options?
Phil Leggetter
 
PDF
Real time web_apps_pycon2012-v1
Avinash Prasad
 
PDF
Adding Realtime to your Projects
Ignacio Martín
 
PPTX
Real time websites and mobile apps with SignalR
Roy Cornelissen
 
PPTX
Real time web
Dingding Ye
 
PDF
Real-Time Web Apps & .NET. What Are Your Options? NDC Oslo 2016
Phil Leggetter
 
PDF
Real Time Web - What's that for?
Martyn Loughran
 
PPTX
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
jeetendra mandal
 
PDF
Building real time applications with Symfony2
Antonio Peric-Mazar
 
PDF
Server-Sent Events (real-time HTTP push for HTML5 browsers)
yay w00t
 
PDF
What is a WebSocket? Real-Time Communication in Applications
Inexture Solutions
 
PDF
How to build a scalable SNS via Polling & Push
Mu Chun Wang
 
PDF
Introduction to WebSockets
Gunnar Hillert
 
PPTX
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
Florin Cardasim
 
PPTX
Codecamp iasi-26 nov 2011-web sockets
Codecamp Romania
 
Real time web apps
Sepehr Rasouli
 
Real-Time with Flowdock
Flowdock
 
Realtime rocks
Vanbosse
 
Nodejs and WebSockets
Gonzalo Ayuso
 
Best practices of building data streaming API
Constantine Slisenka
 
Real-Time Web Apps & Symfony. What are your options?
Phil Leggetter
 
Real time web_apps_pycon2012-v1
Avinash Prasad
 
Adding Realtime to your Projects
Ignacio Martín
 
Real time websites and mobile apps with SignalR
Roy Cornelissen
 
Real time web
Dingding Ye
 
Real-Time Web Apps & .NET. What Are Your Options? NDC Oslo 2016
Phil Leggetter
 
Real Time Web - What's that for?
Martyn Loughran
 
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
jeetendra mandal
 
Building real time applications with Symfony2
Antonio Peric-Mazar
 
Server-Sent Events (real-time HTTP push for HTML5 browsers)
yay w00t
 
What is a WebSocket? Real-Time Communication in Applications
Inexture Solutions
 
How to build a scalable SNS via Polling & Push
Mu Chun Wang
 
Introduction to WebSockets
Gunnar Hillert
 
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
Florin Cardasim
 
Codecamp iasi-26 nov 2011-web sockets
Codecamp Romania
 
Ad

More from Mu Chun Wang (20)

PDF
如何在有限資源下實現十年的後端服務演進
Mu Chun Wang
 
PDF
深入淺出 autocomplete
Mu Chun Wang
 
PDF
你畢業後要任職的軟體業到底都在做些什麼事
Mu Chun Wang
 
PDF
網路服務就是一連串搜尋的集合體
Mu Chun Wang
 
PDF
老司機帶你上手 PostgreSQL 關聯式資料庫系統
Mu Chun Wang
 
PDF
使用 PostgreSQL 及 MongoDB 從零開始建置社群必備的按讚追蹤功能
Mu Chun Wang
 
PDF
Funliday 新創生活甘苦談
Mu Chun Wang
 
PDF
大解密!用 PostgreSQL 提升 350 倍的 Funliday 推薦景點計算速度
Mu Chun Wang
 
PDF
如何使用 iframe 製作一個易於更新及更安全的前端套件
Mu Chun Wang
 
PDF
pppr - 解決 JavaScript 無法被搜尋引擎正確索引的問題
Mu Chun Wang
 
PDF
模糊也是一種美 - 從 BlurHash 探討前後端上傳圖片架構
Mu Chun Wang
 
PDF
Google Maps 開始收費了該怎麼辦?
Mu Chun Wang
 
PDF
Git 可以做到的事
Mu Chun Wang
 
PDF
那些大家常忽略的 Cache-Control
Mu Chun Wang
 
PDF
如何利用 OpenAPI 及 WebHooks 讓老舊的網路服務也可程式化
Mu Chun Wang
 
PDF
如何與全世界分享你的 Library
Mu Chun Wang
 
PDF
如何與 Git 優雅地在樹上唱歌
Mu Chun Wang
 
PDF
API Blueprint - API 文件規範的三大領頭之一
Mu Chun Wang
 
PDF
團體共同協作與版本管理 - 01認識共同協作
Mu Chun Wang
 
PDF
Git 經驗分享
Mu Chun Wang
 
如何在有限資源下實現十年的後端服務演進
Mu Chun Wang
 
深入淺出 autocomplete
Mu Chun Wang
 
你畢業後要任職的軟體業到底都在做些什麼事
Mu Chun Wang
 
網路服務就是一連串搜尋的集合體
Mu Chun Wang
 
老司機帶你上手 PostgreSQL 關聯式資料庫系統
Mu Chun Wang
 
使用 PostgreSQL 及 MongoDB 從零開始建置社群必備的按讚追蹤功能
Mu Chun Wang
 
Funliday 新創生活甘苦談
Mu Chun Wang
 
大解密!用 PostgreSQL 提升 350 倍的 Funliday 推薦景點計算速度
Mu Chun Wang
 
如何使用 iframe 製作一個易於更新及更安全的前端套件
Mu Chun Wang
 
pppr - 解決 JavaScript 無法被搜尋引擎正確索引的問題
Mu Chun Wang
 
模糊也是一種美 - 從 BlurHash 探討前後端上傳圖片架構
Mu Chun Wang
 
Google Maps 開始收費了該怎麼辦?
Mu Chun Wang
 
Git 可以做到的事
Mu Chun Wang
 
那些大家常忽略的 Cache-Control
Mu Chun Wang
 
如何利用 OpenAPI 及 WebHooks 讓老舊的網路服務也可程式化
Mu Chun Wang
 
如何與全世界分享你的 Library
Mu Chun Wang
 
如何與 Git 優雅地在樹上唱歌
Mu Chun Wang
 
API Blueprint - API 文件規範的三大領頭之一
Mu Chun Wang
 
團體共同協作與版本管理 - 01認識共同協作
Mu Chun Wang
 
Git 經驗分享
Mu Chun Wang
 

Recently uploaded (20)

PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
July Patch Tuesday
Ivanti
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 

Firebase introduction

  • 2. 2 Live DEMO https://db.tt/40igKVhc
  • 3. 3 Agenda ● Variety of sync mechanisms ● Firebase
  • 4. Variety of sync mechanisms 4
  • 5. 5 Variety of sync mechanisms ● Polling ● Comet ● Long Polling ● WebSocket ● Engine.IO (Socket.IO) ● Polling & Push
  • 6. 6 Polling send scheduling request
  • 8. 8 Polling client server T0 T1 T2
  • 9. 9 Polling client server T0 T1 T2 T4 T5 T6
  • 10. 10 Polling client server T0 T1 T2 T4 T5 T6 T8 T9 T10
  • 11. 11 Polling ● Pros – Easy to implement ● Cons – No efficiency
  • 12. 12 Comet a never died HTTP request
  • 13. 13 Comet client server
  • 14. 14 Comet client server T0 T1
  • 15. 15 Comet client server T0 T1
  • 16. 16 Comet client server T0 T1 T3 T2
  • 17. 17 Comet client server T0 T1 T3 T6 T2 T5
  • 18. 18 Comet client server T0 T1 T3 T6 T8 T2 T5 T7
  • 19. 19 Comet client server T0 T1 T3 T6 T8 T12 T2 T5 T7 T11
  • 20. 20 Comet ● Pros – Save more network traffic ● Cons – Blocking IO issue – Always get server response, can't send another request
  • 21. 21 Long Polling send a long time request repeatedly when response received
  • 22. 22 Long Polling client server
  • 23. 23 Long Polling client server T0 T1
  • 24. 24 Long Polling client server T0 T1
  • 25. 25 Long Polling client server T0 T1 T4 T3
  • 26. 26 Long Polling client server T0 T1 T4 T3 T5
  • 27. 27 Long Polling client server T0 T1 T4 T3 T5
  • 28. 28 Long Polling client server T0 T1 T4 T3 T5 T21 T20
  • 29. 29 Long Polling ● Pros – Save a little network traffic – Can send another request ● Cons – I don't know
  • 30. 30 WebSocket FDX communications channels over a single TCP connection
  • 33. 33 WebSocket client server T0 T1 T2
  • 34. 34 WebSocket client server T0 T1 T2 T3 T4 T5
  • 35. 35 WebSocket client server T0 T1 T2 T3 T4 T5 T9 T10 T11
  • 36. 36 WebSocket client server T0 T1 T2 T3 T4 T5 T17 T18 T19 T9 T10 T11
  • 37. 37 WebSocket ● Pros – Bidirectional communication – Save more network traffic ● Cons – Proxy & Firewall issue
  • 38. 38 Engine.IO communication layer for Socket.IO
  • 39. 39 Engine.IO - Socket.IO history 0.1~0.6.2 0.6.3~0.6.17 0.7.0~0.9.17 1.0.0~now websocket ✓ ✓ ✓ ✓ server-events ✓ flashsocket ✓ ✓ ✓ htmlfile ✓ ✓ xhr-multipart ✓ ✓ xhr-polling ✓ ✓ ✓ jsonp-polling ✓ polling ✓
  • 40. 40 Engine.IO - Overview
  • 41. 41 Engine.IO - Overview ● Ensure the most reliable realtime communication
  • 42. 42 Engine.IO - Overview ● Ensure the most reliable realtime communication ● Always establishes a long-polling connection first
  • 43. 43 Engine.IO - Overview ● Ensure the most reliable realtime communication ● Always establishes a long-polling connection first – then tries to upgrade to better transports that are "tested" on the side
  • 44. Engine.IO - Upgrade transport seamlessly 44
  • 45. Engine.IO - Upgrade transport seamlessly 45 ● Switches from polling to another transport in between polling cycles
  • 46. Engine.IO - Upgrade transport seamlessly 46 ● Switches from polling to another transport in between polling cycles ● To ensure no messages are lost, the upgrade packet will only be sent once all the buffers of the existing transport are flushed and the transport is considered paused
  • 48. 48 Engine.IO client server T0 T1
  • 49. 49 Engine.IO client server T0 T1
  • 50. 50 Engine.IO client server T0 T1
  • 51. 51 Engine.IO client server T0 T1 T6 T5 T7
  • 52. 52 Engine.IO client server T0 T1 T11 T6 T5 T7 T10
  • 53. 53 Engine.IO client server T0 T1 T11 T6 T5 T7 T10
  • 54. 54 Engine.IO client server T0 T1 T5 T7 T11 T6 T12 T13 T14 T10
  • 55. 55 Engine.IO ● Pros – Auto-switch different network scenario ● Cons – Use particular protocol at server & client
  • 56. 56 Polling & Push simple sync mechanism
  • 57. 57 Polling & Push - Push off client server
  • 58. 58 Polling & Push - Push off client server T0 T1 T2
  • 59. 59 Polling & Push - Push off client server T0 T1 T2 T4 T5 T6
  • 60. 60 Polling & Push - Push off client server T0 T1 T2 T4 T5 T6 T8 T9 T10
  • 61. 61 Polling & Push - Push on client server SNS
  • 62. 62 Polling & Push - Push on client server T0 T1 T2 SNS
  • 63. 63 Polling & Push - Push on client server T0 T1 T2 T22 T23 T24 SNS
  • 64. 64 Polling & Push - Push on client server T0 T1 T2 T22 T23 T24 SNS T30
  • 65. 65 Polling & Push - Push on client server T0 T1 T2 T22 T23 T24 T31 T32 T33 SNS T30
  • 66. 66 Polling & Push ● Pros – Easy to implement ● Cons – No (official statement)
  • 68. 68 Firebase ● Save data in the cloud ● Realtime Data ● Easy authentication ● Bulletproof Security ● Instant Scalability
  • 69. 69 Pattern 1 - Client Only
  • 70. 70 Pattern 1 - Client Only ● Developing a brand new application ● Needs minimal integration with legacy systems or other third party services ● App doesn’t have heavy data processing needs or complex user authentication requirements
  • 71. 71 Pattern 2 - Client & Server
  • 72. 72 Pattern 2 - Client & Server ● To integrate with third party APIs ● Advanced authentication requirements ● Can’t run computationally intensive code on a client, or requires code to run on a trusted server
  • 73. 73 Pattern 3 - Existing App
  • 74. 74 Pattern 3 - Existing App ● An existing full-featured app, and aren’t planning a rewrite ● Codebase is large and cannot change ● Add realtime features without touching the rest of app
  • 77. 77 FAQ ● Enterprise solution
  • 78. 78 FAQ ● Enterprise solution – Custom SLA – 24*7 support – Dedicated clusters – Training
  • 79. 79 FAQ ● Enterprise solution – Custom SLA – 24*7 support – Dedicated clusters – Training ● Concurrent connection
  • 80. 80 FAQ ● Enterprise solution – Custom SLA – 24*7 support – Dedicated clusters – Training ● Concurrent connection – Free plan has 50 max connections, otherwise is unlimited
  • 81. 81 FAQ ● Enterprise solution – Custom SLA – 24*7 support – Dedicated clusters – Training ● Concurrent connection – Free plan has 50 max connections, otherwise is unlimited ● Lock-in
  • 82. 82 FAQ ● Enterprise solution – Custom SLA – 24*7 support – Dedicated clusters – Training ● Concurrent connection – Free plan has 50 max connections, otherwise is unlimited ● Lock-in – Export data to JSON
  • 83. 83 References ● Browser 與 Server 持續同步的作法介紹 ● Comet (programming) ● Engine.IO: the realtime engine ● Engine.IO Protocol ● How Firebase Works ● Firebase Callbacks - what's the underlying trigger? ● Firebase under the hood - watching web sockets in Chrome Developer Tools
  • 84. 84