Upgrade to Pro — share decks privately, control downloads, hide ads and more …

go-socket.io

 go-socket.io

golangのsocket.io実装を使ってパフォーマンスを取ってみた話

Yosuke Furukawa

August 09, 2014
Tweet

More Decks by Yosuke Furukawa

Other Decks in Programming

Transcript

  1. ॻ͍ͨίʔυ // 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)) }) })
  2. ॻ͍ͨίʔυ // 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 Χϝϥ͔Βͷը૾Λड͚ͯ
  3. ॻ͍ͨίʔυ // 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 Χϝϥ͔Βͷը૾Λड͚ͯ