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
WebSocketの圧縮機能とSocket.IO
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Naoyuki Kanezawa
February 10, 2015
Technology
9.3k
5
Share
WebSocketの圧縮機能とSocket.IO
websocketのpermessage-deflate extensionについて
Naoyuki Kanezawa
February 10, 2015
More Decks by Naoyuki Kanezawa
See All by Naoyuki Kanezawa
Introducing Now and Next.js
nkzawa
12
5.6k
Socket.IO 1.0 Client for Javaの紹介
nkzawa
5
1.8k
Socket.IO 1.0の変更点・内部的な話
nkzawa
20
9.3k
Other Decks in Technology
See All in Technology
AWS DevOps Agentはチームメイトになれるのか?/ Can AWS DevOps Agent become a teammate
kinunori
6
740
AIでAIをテストする - 音声AIエージェントの品質保証戦略
morix1500
1
120
エージェントスキルを作って自分のインプットに役立てよう
tsubakimoto_s
0
340
20260428_Product Management Summit_Loglass_JoeHirose
loglassjoe
0
260
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
74k
Standards et agents IA : un tour d’horizon de MCP, A2A, ADK et plus encore
glaforge
0
160
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
2
340
AIはハッカーを減らすのか、増やすのか?──現役ホワイトハッカーから見るAI時代のリアル【MEGU-Meet】
cscengineer
0
140
AIが書いたコードを信じられない問題 〜レビュー負荷を下げるために変えたこと〜 / The AI Code Trust Gap: Reducing the Review Burden
bitkey
PRO
7
1.3k
AI時代のガードレールとしてのAPIガバナンス
nagix
0
280
ハーネスエンジニアリングの概要と設計思想
sergicalsix
9
4.9k
MLOps導入のための組織作りの第一歩
akasan
0
330
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
220
Chasing Engaging Ingredients in Design
codingconduct
0
170
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Typedesign – Prime Four
hannesfritz
42
3k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
130
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
120
Transcript
WebSocketの圧縮機能と Socket.IO 2/10 Node学園#15
ID: nkzawa socket.io コミッター
最近 ws モジュールに permessage-deflate extension を実装しました
wsモジュール nodeのデファクトwebsocket server/client socket.ioでも使用している
古くからあるissueを解決 ws#34 3年前 socket.io#1148 2年前
None
None
permessage-deflate とは
メッセージデータを deflate 圧縮する WebSocketの拡張
HTTPでいうところのgzip圧縮
None
None
permessage-deflate vs http compression
最も重要な違い http: レスポンスにのみ適用 websocket: 双方向
圧縮パラメータ http: 圧縮データのheaderに含める websocket: ハンドシェイク時に交換
windowBits: ウィンドウ・サイズ noContextTakeOver: コンテキストを引き継ぐかどうか
Context Takeover 各メッセージを同一コンテキストで圧縮すること で圧縮率を改善
None
残念なお知らせ
現状Chromeのみサポート ( FireFoxはv37から )
ブラウザでは設定変更ができない JSのWebSocket APIにインターフェースがないため、 常に有効かつデフォルト値で動作する。
謝辞
この機能に関連するNodeの脆弱性を、 @jovi0608 (Shigeki Ohtsu) さん に直していただいたおかげで、 無事リリースできました!m(__)m
socket.io では
次バージョン (v1.4) でサポートされます。 (そもそもsocket.ioのために実装した)
• 圧縮がデフォルトで有効 • polling時はhttp圧縮 • メッセージ毎にon/offを切り替え可能
var socket = io({ perMessageDeflate: true, httpCompression: true }); socket.compress(false).emit(‘woot’);
まとめ
• 地味な機能だけど、パフォーマンス改善にイ ンパクトは大きいはず! • Socket.IOでも近いうちにサポート!