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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebSockets (sflive2012)
Igor Wiedler
June 08, 2012
More Decks by Igor Wiedler
See All by Igor Wiedler
Redis Bedtime Stories
igorw
1
380
Wide Event Analytics (LISA19)
igorw
4
950
a day in the life of a request
igorw
0
170
production: an owner's manual
igorw
0
200
The Power of 2
igorw
0
340
LISP 1.5 Programmer's Manual: A Dramatic Reading
igorw
0
490
The Moral Character of Software
igorw
1
320
interdisciplinary computing (domcode)
igorw
0
330
miniKanren (clojure berlin)
igorw
1
340
Other Decks in Programming
See All in Programming
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
290
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
2
430
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.7k
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
200
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.2k
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
290
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
540
My Marp Sample
sinoue0108
0
110
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
220
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
360
メールのエイリアス機能を履き違えない
isshinfunada
0
250
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.4k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
4 Signs Your Business is Dying
shpigford
187
23k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Building the Perfect Custom Keyboard
takai
2
850
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
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