Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building Real-Time Applications in Ember.js
Search
Steve Kinney
March 04, 2015
Technology
0
120
Building Real-Time Applications in Ember.js
Steve Kinney
March 04, 2015
Tweet
Share
More Decks by Steve Kinney
See All by Steve Kinney
Introduction to Testing
stevekinney
0
110
Web Security, Frontend Masters
stevekinney
0
3.2k
Making Music with the Web Audio API, JSConf Colombia 2023
stevekinney
0
100
React and TypeScript, Turing School
stevekinney
0
340
Redux Workshop, 2021-05-05
stevekinney
2
2.2k
TypeScript and React Utility Types
stevekinney
1
200
A Gentle Introduction to GraphQL Resolvers
stevekinney
1
160
React State
stevekinney
11
10k
React State: useEffect and Custom Hooks
stevekinney
0
240
Other Decks in Technology
See All in Technology
Gemini でコードレビュー知見を見える化
zozotech
PRO
1
250
「Managed Instances」と「durable functions」で広がるAWS Lambdaのユースケース
lamaglama39
0
310
生成AI活用の型ハンズオン〜顧客課題起点で設計する7つのステップ
yushin_n
0
140
意外とあった SQL Server 関連アップデート + Database Savings Plans
stknohg
PRO
0
310
re:Invent2025 コンテナ系アップデート振り返り(+CloudWatchログのアップデート紹介)
masukawa
0
360
第4回 「メタデータ通り」 リアル開催
datayokocho
0
130
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
360
[デモです] NotebookLM で作ったスライドの例
kongmingstrap
0
140
re:Invent 2025 ふりかえり 生成AI版
takaakikakei
1
200
文字列の並び順 / Unicode Collation
tmtms
3
570
【AWS re:Invent 2025速報】AIビルダー向けアップデートをまとめて解説!
minorun365
4
510
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Scaling GitHub
holman
464
140k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Building Flexible Design Systems
yeseniaperezcruz
330
39k
Documentation Writing (for coders)
carmenintech
76
5.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
730
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Raft: Consensus for Rubyists
vanstee
141
7.2k
Context Engineering - Making Every Token Count
addyosmani
9
510
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
100
Transcript
Building Real-Time Applications in Ember EmberConf 2015
Hi. I'm Steve. @stevekinney |
[email protected]
None
None
Let's talk about building real-time applications with Ember.
This is a story about WebSockets…
It's also a story about integrating all sorts of browser
functionality and third-party code into our applications.
What even is a WebSocket?
WebSockets are an HTTP independent, bi-directional, TCP-based protocol over port
80 standardized in 2011 by the IETF as RFC 6455.
Duh.
None
What are WebSockets used for?
Quick Demo
Can I actually use WebSockets?
None
None
Now, that we know everything there is to know about
WebSockets, let’s get to implementing them.
None
None
Step Zero: We need a WebSocket server, right?
A WebSocket server in fourteen lines.
var WebSocketServer = require('ws').Server; var socket = new WebSocketServer({ port:
8080 }); socket.on('connection', function(connection) { connection.on('message', function(message) { socket.broadcast(message); }); }); socket.broadcast = function(data) { this.clients.forEach(function (client) { client.send(data); }); };
What does this look like on the client?
A Traditional Example var socket = io(); $('form').submit(function(){ socket.emit('chat message',
$('#m').val()); $('#m').val(''); return false; }); socket.on('chat message', function(msg){ $('#messages').append($('<li>').text(msg)); });
Ugh. DOM/selector- based development. #fail
—Erik Bryn “Selector-based programming”
We can do better.
Let's try two or three different approaches.
Approach #1: A standalone controller
ember generate controller websocket
app/controllers/ websocket.js
None
None
None
None
None
None
None
None
None
None
app/controllers/ chatroom.js
None
None
None
None
None
None
None
app/routes/ chatroom.js
None
None
Quick Demo
This approach works great, but it's somewhat limited.
None
Approach #2: Dependency Injection with Services
ember generate service websocket
installing create app/services/websocket.js create app/initializers/websocket.js
app/initializers/ websocket.js
None
None
None
None
None
Let's move that code from the controller into our service.
rm -rf app/controllers/websocket.js
app/controllers/ chatroom.js
None
None
That's it.
Approach #3: Using Socket.io
Point of Interest: Socket.io is both a server- and client-
side library.
To each her own.
Let's set up a Socket.io server
None
None
bower install sio-client
None
app/services/ websocket.js
None
app/controllers/ chatroom.js
None
None
Thank you. Code example: stevekinney/emberconf-chat Twitter and Github: @stevekinney Email:
[email protected]
Hire our students: http://people.turing.io/