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
煩雑なSkills管理をSoC(関心の分離)により解決する――関心を分離し、プロンプトを部品として育てるためのOSSを作った話 / Solving Complex Skills Management Through SoC (Separation of Concerns)
nrslib
4
850
Java 21/25 Virtual Threads 소개
debop
0
340
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
450
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
580
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
770
TiDBのアーキテクチャから学ぶ分散システム入門 〜MySQL互換のNewSQLは何を解決するのか〜 / tidb-architecture-study
dznbk
1
150
事業会社でのセキュリティ長期インターンについて
masachikaura
0
240
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
390
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
700
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
340
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.3k
Featured
See All Featured
Paper Plane
katiecoart
PRO
1
49k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
A better future with KSS
kneath
240
18k
Odyssey Design
rkendrick25
PRO
2
570
Crafting Experiences
bethany
1
110
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
120
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
140
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing Experiences People Love
moore
143
24k
Agile that works and the tools we love
rasmusluckow
331
21k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
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