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
go-socket.io
Search
Yosuke Furukawa
PRO
August 09, 2014
Programming
6
5.4k
go-socket.io
golangのsocket.io実装を使ってパフォーマンスを取ってみた話
Yosuke Furukawa
PRO
August 09, 2014
Tweet
Share
More Decks by Yosuke Furukawa
See All by Yosuke Furukawa
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
270
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
150
Removing Corepack
yosuke_furukawa
PRO
9
1.3k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
2.5k
Strip Types と Storage
yosuke_furukawa
PRO
4
340
Module Harmony について
yosuke_furukawa
PRO
3
1.5k
LTのやり方
yosuke_furukawa
PRO
16
2.2k
AppRouter Panel Talk
yosuke_furukawa
PRO
3
700
Node.js v22 で変わること
yosuke_furukawa
PRO
13
5.3k
Other Decks in Programming
See All in Programming
flutterkaigi_2024.pdf
kyoheig3
0
180
Outline View in SwiftUI
1024jp
1
350
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
170
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
Amazon Qを使ってIaCを触ろう!
maruto
0
420
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1.1k
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
130
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
670
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.9k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
140
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Site-Speed That Sticks
csswizardry
0
40
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Docker and Python
trallard
40
3.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
HPTPDLFUJP !ZPTVLF@GVSVLBXB
@yosuke_furukawa Node.jsϢʔβʔάϧʔϓද / DeNAॴଐ
NZXPSLT SFBMUJNFJOUFSBDUJWFͳήʔϜΛ࡞Δ ੑೳվળ ϑϩϯτΤϯυͷ։ൃޮΛ্͛Δ͜ͱ
(PMBOHNFFUTTPDLFUJP
TPDLFUJPJT SFBMUJNFMJCSBSZ جຊXFCTPDLFUΛ͏͕ɺXFCTPDLFU͕ܨ͕Β ͳ͍ڥͰMPOHQPMMJOHʹΓସ͑ͯ͘ΕΔ ࠷ۙWʹͳΓɺCJOBSZରԠɺॳظଓߴԽ ͕ߦΘΕͨ
TPDLFUJPW ৄ͘͠ɺ4PDLU*0հΛʜ IUUQZPTVLFGVSVLBXBIBUFOBCMPHDPNFOUSZ
ͦΜͳTPDLFUJPWʹ ࠷ۙHPMBOH࣮͕
HPPHPMMFFHPTPDLFUJP །ҰͷWରԠ͞Ε͍ͯΔ HPMBOHͰॻ͔ΕͨTPDLFUJP
%&.0 JNBHFTUSFBNJOH IUUQ IUUQ
ॻ͍ͨίʔυ // NewServerͰαʔόʔΛinstanceԽ server, _ := socketio.NewServer(nil) // On(“connection”), On(“image”)ͱ͍͏ײ͡
server.On("connection", func(so socketio.Socket) { so.Join("chat") so.On("image", func(msg interface{}) { m := &message{ Id: so.Id(), Blob: msg, } res, _ := json.Marshal(m) so.BroadcastTo("chat", "image", string(res)) }) so.On("disconnection", func() { m := &message{ Id: so.Id(), } res, _ := json.Marshal(m) so.BroadcastTo("chat", "leave", string(res)) }) })
ॻ͍ͨίʔυ // NewServerͰαʔόʔΛinstanceԽ server, _ := socketio.NewServer(nil) // On(“connection”), On(“image”)ͱ͍͏ײ͡
server.On("connection", func(so socketio.Socket) { so.Join("chat") so.On("image", func(msg interface{}) { m := &message{ Id: so.Id(), Blob: msg, } res, _ := json.Marshal(m) so.BroadcastTo("chat", "image", string(res)) }) so.On("disconnection", func() { m := &message{ Id: so.Id(), } res, _ := json.Marshal(m) so.BroadcastTo("chat", "leave", string(res)) }) }) ଓऀશһʹCSPBEDBTU Χϝϥ͔Βͷը૾Λड͚ͯ
ॻ͍ͨίʔυ // NewServerͰαʔόʔΛinstanceԽ server, _ := socketio.NewServer(nil) // On(“connection”), On(“image”)ͱ͍͏ײ͡
server.On("connection", func(so socketio.Socket) { so.Join("chat") so.On("image", func(msg interface{}) { m := &message{ Id: so.Id(), Blob: msg, } res, _ := json.Marshal(m) so.BroadcastTo("chat", "image", string(res)) }) so.On("disconnection", func() { m := &message{ Id: so.Id(), } res, _ := json.Marshal(m) so.BroadcastTo("chat", "leave", string(res)) }) }) ΠϯλϑΣʔεΛ/PEFKTʹدͤͯͯɺ 4PDLFU*0Λͬͨ͜ͱ͕͋ΔਓͳΒ؆୯ʹ͑Δ ଓऀશһʹCSPBEDBTU Χϝϥ͔Βͷը૾Λड͚ͯ
1FSGPSNBODF
݅ .BD#PPL1SP $16()[*OUFM$PSFJ .FNPSZ(# HPTPDLFUJPWTTPDLFUJP ଓ͕Ͱͨ͘͞ΜૹΔ߹ͱ ଓ͕ͨ͘͞Μ͋ͬͯɺ୯ൃͷϦΫΤετ͢Δ߹Ͱ࣮ ߦ
͏গ͠ࡉ͔͍݅ (0."9130$ίΞʹઃఆ /PEFKTͰDMVTUFSΘͣ ͏ͱ3FEJTඞ ཁͩ͠ɺएׯ໘ (PW /PEFW
None
TPDLFUJPͷํ͕ૣ͍
ଓ͕ଟ͍࣌
ʊਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹHPTPDLFUJPؼͬͯ͜ͳ͍ɹʻ ʉ:?:?:?:?:?:?:?:?:?:?:ʉ
͓ർΕ༷Ͱͨ͠ɻɻɻ ʊਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹHPTPDLFUJPؼͬͯ͜ͳ͍ɹʻ ʉ:?:?:?:?:?:?:?:?:?:?:ʉ
·ͱΊ
·ͱΊ XFCTPDLFUͱMPOHQPMMJOHΛΓସ͑ͯ͘ΕΔϥΠϒϥ ϦͰ͋ΔHPTPDLFUJPΛࢼͯ͠Έͨ ͜ΕΛར༻͢ΔͱΠϯλϥΫςΟϒͳXFCΛHPMBOHͰ ࡞Δ͜ͱՄೳ ͨͩ͠ɺ/PEFKTͷํ͕·ͩੑೳྑ͍ʢࠓޙʹظʣ ಉ࣌ଓΛଟ͘͢Δͱؼͬͯ͜ͳ͍ʜ ଓपΓͰό ά͕͋Γͦ͏
·ͱΊ XFCTPDLFUͱMPOHQPMMJOHΛΓସ͑ͯ͘ΕΔϥΠϒϥ ϦͰ͋ΔHPTPDLFUJPΛࢼͯ͠Έͨ ͜ΕΛར༻͢ΔͱΠϯλϥΫςΟϒͳXFCΛHPMBOHͰ ࡞Δ͜ͱՄೳ ͨͩ͠ɺ/PEFKTͷํ͕·ͩੑೳྑ͍ʢࠓޙʹظʣ ಉ࣌ଓΛଟ͘͢Δͱܨ͕Βͳ͍ʜ ଓपΓͰόά ͕͋Γͦ͏ ͱ͍͏Θ͚Ͱ·ͩ͏ͷਏͦ͏ɻ
QVMMSFRJTTVFૹΖ͏ɻ
͓·͚ HPTPDLFUJPFNJUUFS͍ͬͯ͏ͭ࡞ͬͨɻ ͜ΕHPMBOHͷϓϩηε͔Β/PEFKTͰ࡞ΒΕ ͨTPDLFUJPʹଓ͢Δౕ ϞνṷͰɺಉ࣌ଓ͕ଟ͘ͳΔࣄ͕͋Δ ͳΒTPDLFUJPʹͤͨ΄͏͕ྑͦ͞͏ɻ