Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebSockets (sflive2012)
Search
Igor Wiedler
June 08, 2012
Programming
6
2.7k
WebSockets (sflive2012)
Igor Wiedler
June 08, 2012
Tweet
Share
More Decks by Igor Wiedler
See All by Igor Wiedler
Redis Bedtime Stories
igorw
1
310
Wide Event Analytics (LISA19)
igorw
4
930
a day in the life of a request
igorw
0
150
production: an owner's manual
igorw
0
170
The Power of 2
igorw
0
310
LISP 1.5 Programmer's Manual: A Dramatic Reading
igorw
0
440
The Moral Character of Software
igorw
1
280
interdisciplinary computing (domcode)
igorw
0
300
miniKanren (clojure berlin)
igorw
1
310
Other Decks in Programming
See All in Programming
開発に寄りそう自動テストの実現
goyoki
2
1.2k
Developing static sites with Ruby
okuramasafumi
0
310
AIコーディングエージェント(NotebookLM)
kondai24
0
210
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.3k
sbt 2
xuwei_k
0
300
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
120
AIエージェントの設計で注意するべきポイント6選
har1101
5
920
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
190
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
500
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
450
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
160
Integrating WordPress and Symfony
alexandresalome
0
160
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
Practical Orchestrator
shlominoach
190
11k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
93
How to build a perfect <img>
jonoalderson
0
4.6k
Building Flexible Design Systems
yeseniaperezcruz
330
39k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Evolving SEO for Evolving Search Engines
ryanjones
0
71
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Limits of Empathy - UXLibs8
cassininazir
1
180
Deep Space Network (abreviated)
tonyrice
0
18
Transcript
WEBSOCKETS
• Symfony2 • Silex • Composer igorw @igorwesome
WEBSOCKETS
WEB
Application HTTP Presentation TCP Session TCP Transport TCP Network IP
Data Link Physical
Application HTTP Presentation TCP Session TCP Transport TCP Network IP
Data Link Physical
client
request client
reponse client request
THIS IS A GOOD THING
BUT
NOT FOR EVERYTHING
UNIDIRECTIONAL
None
LATENCY
LATENCY KEEP-ALIVE PIPELINING SPDY
STATELESS
Application HTTP Presentation TCP Session TCP Transport TCP Network IP
Data Link Physical
Application HTTP Presentation TCP Session TCP Transport TCP Network IP
Data Link Physical
WEBSOCKETS
SOCKETS
WEBSOCKETS
PROTOCOL API
THE WEBSOCKET PROTOCOL
browser
None
• Handshake / Upgrade • TCP + framing • Proxies
• Supports TLS (SSL)
RFC 6455
THE WEBSOCKET API
browser
var ws = new WebSocket('ws://example.org:8080/updates'); ws.onopen = function () {
ws.send('hello'); }; ws.onmessage = function (event) { console.log(event.data); };
USE CASES •Games •Notifications •Collaboration •Statistics •Chat
4.0+ (2009) 6.0+ (2011) 10.70+ (2012) 5.0+ (2010) 10+ (2012)
• transport abstraction (fallbacks) • broadcasting, reconnection, serialization, other stuff
• monolithic! (and almost trying to fix it)
SOCKJS
var ws = new WebSocket(url);
var ws = new SockJS(url);
ASYNC STACK Connect Express SockJS
ASYNC STACK ? ? SockJS
ASYNC STACK EventMachine ? ? SockJS
ASYNC STACK ? ? SockJS
Y U NO PHP?
SYNC STACK Application
ASYNC Connect Express SockJS SYNC Application
None
None
*MQ
*MQ Sync Async
DEMO
DEBUGGING •printf •chrome inspector •wssh •ngrep •zmqc
RECAP • Use SockJS • Polyglot is the future •
Learn from the MQs
LINKS • tools.ietf.org/html/rfc6455 • dev.w3.org/html5/websockets • sockjs.org
github.com/igorw/websockets-talk
CREDITS • thenounproject.com • stopwatch
None
None
nodephp.org github.com/cboden/Ratchet
Questions? @igorwesome speakerdeck.com /u/igorw joind.in/6586