-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
612 lines (411 loc) · 12.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
<!DOCTYPE html>
<html>
<head>
<title>A 10 Minute Guide to Choosing a Realtime Framework</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="./themes/pusher-default/theme.css" />
</head>
<body>
<textarea id="source">
name: lblue
layout: true
class: bg-light, center, middle
---
name: dblue
layout: true
class: bg-dark, center, middle
---
template: dblue
class: title, h1-big, pinkie-list
# A 10 Minute Guide to Choosing a Realtime Framework
* Phil @leggetter
* Head of Evangelism
* Pusher
???
* 15 years - realtime tech
* before probably all solutions existed
* so many frameworks = difficult to choose
---
template: dblue
class: title, h1-big
![](./themes/pusher-default/img/pusher-logos/pusher-slogan-dark.png)
???
* Our logo
* Interested in realtime?
* Come by our booth
* Love to hear what you're building
---
template: dblue
class: h1-big
# What is Realtime?
???
* No real time for detail
* But a few examples
---
template: dblue
class: em-text, bg-cover, trans-h
background-image: url(./img/itv-news-may-2014.png)
# Notifications & Signalling
???
* Something has happened
* Changed
* Alert - do something
---
class: center, bg-cover, em-text, trans-h
background-image: url(./img/delighted-app.gif)
# Activity Streams
???
* a stream of activity
* things have - and are - happening
* synonymous with social apps
* Twitter
* Facebook
* Google+
* News
* Sports
---
template: dblue
class: bg-cover, em-text, trans-h
background-image: url(./img/senate-election-results.png)
# Data Visualizations
---
template: lblue
class: bg-video, trans-h, em-text
# Chat
<video id="video" autoplay="true" loop="true">
<source src="./img/pie.mp4" type="video/mp4">
</video>
???
* The 101 of realtime
* An interactive experience
* Real-time matters
---
template: lblue
class: trans-h
background-image: url(./img/sprintly.jpg)
# Multi-User Collaboration
???
* Google Apps
* Cloud 9
* TODO: other
---
template: lblue
class: bg-cover, trans-h
background-image: url(./img/quizup.png)
# Multiplayer Games
---
template: dblue
class: h2-big
background-image: url(./themes/pusher-default/img/code-back.jpg)
## You want this functionality.
## <span class="pinkie">But, how do you choose a Realtime Framework?</span>
---
template: lblue
class: h1-big, bg-cover
background-image: url(./img/maybee.gif)
## Use Socket.IO, right?
---
template: lblue
class: h1-big, bg-cover, em-text
background-image: url(./img/falkirk-wheel.gif)
# 1. Use an existing solution
## Don't reinvent the wheel
<small>Unless you've a unique use case</small>
---
template: lblue
## Why use an existing solution?
* Fallback/upgrade hacks still required
* Support/Community
* Maintenance
* Future features
* Scaling
---
class: bg-white, bg-cover
background-image: url(./img/realtime-web-solutions-updated.png)
---
class: center, middle, h1-big, bg-cover, em-text
background-image: url(./img/choose-a-lang.gif)
# 2. Use languages you're comfortable with
---
template: lblue
class: pinkie-bold
## Solutions by language
* **Java**: Netty, Jetty
* **JavaScript (Node.JS)**: Faye, Socket.IO (Engine.IO), Primus.io
* **.NET (C#)**: SignalR, XSockets
* **Python**: Lots of options built on Tornado
* **PHP**: Erm... ReactPHP... Ratchet
* **Ruby**: Faye
* *Language agnostic*: most hosted services
---
template: dblue
class: h1-big, trans-h, bg-contain
background-image: url(./img/native-mobile.jpeg)
# 3. Native Mobile Support?
---
template: lblue
## Native Mobile Support?
* Only some have mobile clients
* How much data are you sending?
* SSL required on 3/4G networks
* HTTP fallback required?
---
template: lblue
## Solutions with Native Mobile Clients
.left[* Faye
* Firebase
* Hydna
* PubNub]
.right[* Pusher
* Realtime
* SignalR
* Socket.IO]
---
template: dblue
class: h1-big
# 4. Understand your App's Functionality
---
template: lblue
## 4. Understand your App's Functionality
* Information Architecture a.k.a Data
* Interaction Complexity:
* How users interact with your app
* Client <-> Server interactions
* Understand the framework functionality you need...
???
* Going back to the 4 data paradigms:
* Do you want a few simple streams of data - onMessage
* Are there multiple streams where the app chops and changes the information it wants - PubSub
* Do you need bi-directional communication?
* Are you effectively manipulating a share data structure - sync
* Or are you trying to provide access to server functionality in a more elegant way - RMI
---
template: lblue
class: left-content
## onMessage
```js
// client
var sock = new SockJS( 'http://localhost:9999/sockjs' );
sock.onmessage = function( e ) {
console.log( 'message', e.data );
};
```
```js
// server
sock.write( 'hello SockJS' );
```
---
template: lblue
class: left-content
## PubSub
```js
// client
var client = new FayeClient();
client.subscribe( 'fwdjs-tweets', function( tweet ) {
// Handle Update
} );
```
```js
// server
var tweet = {
text: '#ForwardJS rocks!',
user_name: '@leggetter'
}
Faye.publish( 'fwdjs-tweets', tweet );
```
---
template: lblue
class: left-content
## Evented PubSub
```js
// client
var pusher = new Pusher( APP_KEY );
var channel = pusher.subscribe( 'fwdjs-tweets' );
channel.bind( 'new_tweet', function( tweet ) {
// Handle Update
} );
channel.bind( 'tweet_updated', function( tweet ) {} );
channel.bind( 'tweet_deleted', function( tweet ) {} );
```
```js
// server
var tweet = {
text: '#ForwardJS rocks!',
user_name: '@leggetter'
}
pusher.trigger( 'fwdjs-tweets', 'new_tweet', tweet );
```
---
template: lblue
class: left-content
## Data Sync
```js
var myDataRef = new Firebase('https://yo.firebaseio.com/');
myDataRef.push( {name: '@leggetter', text: 'Yo!'} );
myDataRef.on( 'child_added', function(snapshot) {
// Data added
});
myDataRef.on( 'child_changed', function(snapshot) {
// Data has changed
});
myDataRef.on( 'child_removed', function(snapshot) {
// Data removed
});
```
???
* Manipulating collection of data
* Not dealing with Messages
---
template: lblue
class: left-content
## RMI
```js
// client
$.connection.hub.start(); // async
var chat = $.connection.chatHub;
chat.client.broadcastMessage = function (name, message) {
// handle message
};
chat.server.send( 'me', 'hello world' );
```
```csharp
// server
public class ChatHub : Hub
{
public void Send(string name, string message)
{
// Call the broadcastMessage method to update clients.
Clients.All.broadcastMessage(name, message);
}
}
```
---
template: lblue
background-image: url(./img/rtw-tech-decision-matrix-white.png)
---
template: lblue
background-image: url(./img/rtw-tech-decision-matrix-apps.png)
???
---
template: lblue
background-image: url(./img/rtw-tech-decision-matrix-solutions.png)
???
* SockJS - focus on simple connections
* Some solutions offer PubSub and data sync
* Dropbox - offer simple DataStore API
* Only know a few RMI options
* New solutions: Meteor, DerbyJS, SailsJS - maybe a new category for these?
---
template: dblue
class: h1-big
# 5. Where are you in Development?
---
template: lblue
class: block
# You already have an app
* How to integrate:
* Self-hosted
* Hosted
---
template: lblue
class: bottom
background-image: url(./img/realtime-web-stack-tight-integration-self-hosted.png)
### Self Hosted <small>(Tightly Coupled)</small>
???
* Less initial overhead - quick Integration
* As project grows complexity increases
* Updating request/response cycle may impact realtime functionality and vise-versa
* Likely that the web server is handling load of both standard HTTP and realtime i.e. WebSocket, Server-Sent Events, HTTP fallbacks
---
template: lblue
class: bottom
background-image: url(./img/realtime-web-stack-integration-self-hosted.png)
### Self Hosted <small>(Loosely Coupled)</small>
???
* Generally agreed that a loosely coupled architecture is going to be easier to change and maintain
* Your DB may even be message-queue-capable e.g. Redis.
* So you simply need to hook your realtime server into that
* Web App for HTTP
* Realtime for realtime functionality
* Scale-out realtime server in the same way as web server
---
template: lblue
class: fill-img
### Hosted
![](./img/realtime-web-stack-integration-hosted.png)
???
* Load-balancing connections
* Maintaining state of connections
* Synchronising data between nodes
* Mapping connections to users?
* Dedicated hosted service will offer :
* Make things easier and faster
* Reduce scaling complexities
* Natural loose coupling via an API
* Where is your value?
* Features v Infrastructure
---
template: lblue
class: block
## Shout-out to Hosted Services
.left[* Dropbox
* Fanout.io
* Firebase
* GDrive Realtime API
* Hydna
* Meteor]
.right[* PubNub
* Pusher
* Realtime.co
* Simperium
* Syncano]
---
template: lblue
# You are just starting out
* Architecture considerations
* Loose coupling
* Hosted?
* Go all-in with a "new breed of framework"
---
template: lblue
### Realtime Framework
* Meteor & hosted offering
* SailsJS
* SocketStream
### BaaS (Back-end as a Service)
* Firebase
* Simperium
See: http://nobackend.org/
???
* A Framework where you can self-host
* Or hosted service: a BaaS where your can focus mainly on front-end functionality
* In both cases: Realtime is baked in
* In some cases even HTML templating will be baked in
* and those templates will auto-updated when you update data structures
* Will "Realtime" simply become an expected piece of functionality in the same way we expect to be able to persist data?
---
template: dblue
## 5 Realtime Framework Considerations
1. Use an Existing Solution
2. Use a language you're comfortable with
3. Do you need native mobile support?
4. onMessage, PubSub (Evented), RMI or DataSync
5. Where in development?
---
template: dblue
class: title, h1-big, pinkie-list
* Phil @leggetter
* Head of Evangelism
* Pusher
</textarea>
<script src="bower_components/remark/out/remark.js">
</script>
<script>
var slideshow = remark.create( {
navigation: {
scroll: false,
}
});
</script>
</body>
</html>