Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebSockets (sflive2012)
Search
Igor Wiedler
June 08, 2012
Programming
2.7k
6
Share
WebSockets (sflive2012)
Igor Wiedler
June 08, 2012
More Decks by Igor Wiedler
See All by Igor Wiedler
Redis Bedtime Stories
igorw
1
350
Wide Event Analytics (LISA19)
igorw
4
940
a day in the life of a request
igorw
0
160
production: an owner's manual
igorw
0
190
The Power of 2
igorw
0
330
LISP 1.5 Programmer's Manual: A Dramatic Reading
igorw
0
470
The Moral Character of Software
igorw
1
310
interdisciplinary computing (domcode)
igorw
0
320
miniKanren (clojure berlin)
igorw
1
330
Other Decks in Programming
See All in Programming
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
360
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
7
2.7k
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
210
[BalkanRuby 2026] Drop your app/services!
palkan
3
700
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
870
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
240
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
380
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
9
2.7k
今さら聞けないCancellationToken
htkym
0
200
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
240
New "Type" system on PicoRuby
pocke
1
210
AI Agent と正しく分析するための環境作り
yoshyum
3
610
Featured
See All Featured
Making Projects Easy
brettharned
120
6.6k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Code Reviewing Like a Champion
maltzj
528
40k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
580
Tell your own story through comics
letsgokoyo
1
930
Building the Perfect Custom Keyboard
takai
2
770
Context Engineering - Making Every Token Count
addyosmani
9
910
Skip the Path - Find Your Career Trail
mkilby
1
130
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