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
340
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
180
The Power of 2
igorw
0
320
LISP 1.5 Programmer's Manual: A Dramatic Reading
igorw
0
460
The Moral Character of Software
igorw
1
300
interdisciplinary computing (domcode)
igorw
0
310
miniKanren (clojure berlin)
igorw
1
320
Other Decks in Programming
See All in Programming
How Swift's Type System Guides AI Agents
koher
0
210
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
340
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
320
Coding as Prompting Since 2025
ragingwind
0
780
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
340
CDK Deployのための ”反響定位”
watany
4
670
Rethinking API Platform Filters
vinceamstoutz
0
11k
存在論的プログラミング: 時間と存在を記述する
koriym
5
860
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
260
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
230
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
0
120
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
260
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
3
310
Product Roadmaps are Hard
iamctodd
PRO
55
12k
[SF Ruby Conf 2025] Rails X
palkan
2
940
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
It's Worth the Effort
3n
188
29k
Speed Design
sergeychernyshev
33
1.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Design in an AI World
tapps
0
190
Un-Boring Meetings
codingconduct
0
260
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
240
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