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

Twilio IP メッセージング勉強会資料

Twilio IP メッセージング勉強会資料

Kiminari Homma

August 05, 2016
Tweet

More Decks by Kiminari Homma

Other Decks in Technology

Transcript

  1. 19:00 ~ 19:15 ɹड෇։࢝ 19:15 ~ 19:20 ɹձ৔ͷઆ໌ / Keynote

    19:20 ~ 19:45 ɹWeb ͷϦΞϧλΠϜͱ IP ϝοηʔδϯά ɹ- ηϧϑϦʔ ຊؒ͞· 19:50 ~ 20:20 ɹIPϝοηʔδϯάΛLambdaͰ࣮૷ͨ͠࿩ ɹ- άϩʔόϧɾΠϯλʔωοτɾδϟύϯ ߴڮ͞· 20:25 ~ 21:00 ɹiOS༻IP MessagingΞϓϦΛJavaScriptͰ࡞ͬͯΈͨ ɹ- ീ໦͞· 21:00 ~ ɹɹɹɹر๬ऀͱผձ৔Ͱ࠙਌ձ༧ఆ Twilio IP ϝοηʔδϯάษڧձ
  2. ຊؒ ߖ੒ @kimihom ϘΫίί ӡӦऀ http://www.bokukoko.info/ CTO at selfree,llc Twilio,

    Ruby on Rails, AWS, Heroku, Android, iOS TwilioJP-UG ϝϯόʔ
  3. Twilio? Voice Client ి࿩ͷड৴ Ի੠ϑΝΠϧ࠶ੜ΍௨࿩࿥Ի μΠϠϧૢ࡞ʹԠͨ͡ಈ࡞੾ସ ௨࿩தͷి࿩ͷ੍ޚ ి࿩ͷൃ৴ ϒϥ΢βɾεϚϗͰి࿩ Voice

    ͱ࿈ಈͯ͋͠ΒΏΔ௨࿩Λૢ࡞ and More.. →ࣗ༝ʹ૊Έ߹ΘͤՄʂ ి࿩Λ API Ͱ؆୯ʹγεςϜԽͰ͖·͢ɻ
  4. A ͷΠϕϯτΛ B ͕ݕ஌͢Δʹ͸ ɾϙʔϦϯά ɾComet ɾServer Sent Events ɾWebSocket

    ɾPusher, PubNub ɾFirebase, Milkcocoa, IP ϝοηʔδϯά ࣗલ ֎෦
  5. ࣗલͰ΍ΔͳΒ WebSocket socket.io (Node.js) ActionCable (Ruby on Rails 5.0~ )

    ͕ͩ… ɾઐ༻αʔόʔͷ༻ҙͱ؅ཧ͕ඞཁ νϟοτΞϓϦͷΑ͏ͳϦΞϧλΠϜ͕ओػೳͳαʔϏεͳΒ͍͍͚Ͳ… ɾεέʔϧ͢Δͱ͖Ͳ͏͢Δͷʁ ɹ࡞Δ͚ͩͳΒ؆୯͚ͩͲɺͦͷઌӡ༻Ͱ͖Δʁ
  6. ֎෦ WebSocket αʔϏε Pusher, PubNub ɾγϯϓϧͳ ϦΞϧλΠϜػߏ ɾϝοηʔδػೳ͸ࣗ෼Ͱ࣮૷͢Δඞཁ༗ ɾσʔλ͸ࣗ෼ͨͪͰ؅ཧ Firebase,

    Milkcocoa, IP ϝοηʔδϯά ɾϝοηʔδػೳ͸ SDK Ͱطʹ༻ҙ (։ൃऀ޲͚ Dropbox) ɾϝοηʔδσʔλ͸αʔϏεଆͰอଘ (ಉظ) ɾΦϑϥΠϯରԠ, ϚϧνσόΠεରԠͳͲ
  7. ࠓͰ͖Δ͜ͱ νϟϯωϧ࡞੒ɾ࡟আ private, public ͳνϟϯωϧ ϝϯόʔট଴ɺ࡟আɺऔಘ νϟϯωϧ΁ࢀՃɺୀࣨ ϝοηʔδͷૹड৴ɾฤूɾ࡟আ ϢχʔΫͳνϟϯωϧ໊ ෳ਺σόΠεͰͷಉظ

    ΦϑϥΠϯରԠ WebhookͰͷΠϕϯτίʔϧόοΫ λΠϓதදه ໾ׂ΍ݖݶ iOS, Android, JavaScript SDK APN, GCM ϓογϡ௨஌ طಡεςʔλε ࠓޙͰ͖ΔΑ͏ʹͳΔ͜ͱ iOS. AndroidͰطಡεςʔλε ը૾΍ϏσΦϝοηʔδ ௨஌ͱ࣮ߦΦϓγϣϯ ϢʔβʔϓϩύςΟ
  8. 5XJMJP"DDPVOU 4FSWJDF $IBOOFM 6TFS JEFOUJUZ 3PMF IP ϝοηʔδϯά֓ཁ $IBOOFM .FNCFS

    JEFOUJUZ .FTTBHF JEFOUJUZ .FTTBHF JEFOUJUZ .FNCFS JEFOUJUZ $IBOOFM3PMF 6TFS JEFOUJUZ 3PMF 4FSWJDF3PMF
  9. identity ͕େࣄʂ IPM ಺ͰਓΛࣝผ͢Δจࣈྻ ෳ਺σόΠε͋ͬͯ΋ಉ͡ਓͳΒಉ͡ identity identity ͕࢖ΘΕ͍ͯΔͱ͜Ζɿ ɹɾࣗ෼͸୭͔(τʔΫϯ࡞੒) ɹɾ୭͕ൃݴ͔ͨ͠

    ɹɾ୭͕νϟϯωϧॴ༗ऀ͔ ɹɾ୭͕νϟϯωϧʹ͍Δ,ೖͬͨ,ୀ੮͔ͨ͠ Ϣʔβʔৄࡉσʔλ͸identityͱඥ෇͚ͯࣗ෼ͨͪͰ؅ཧ ͠ͳ͚Ε͹ͳΒͳ͍ɻ
  10. User ͱ Member ͱ͸ User - identity ʹର͢Δ “Service Role”

    ͷ؅ཧͷΈ - τʔΫϯऔಘ࣌ʹ identity ͔Βࣗಈੜ੒ or REST API Ͱ࡞੒ Member - identity ͕Ͳͷ Channel ʹ͍Δ͔ - identity ʹର͢Δ “Channel Role” ͷ؅ཧ - SDK ͷ channel.join() or REST API Ͱ Channel ʹ Member ௥Ճ
  11. 5XJMJP"DDPVOU 4FSWJDF $IBOOFM 6TFS JEFOUJUZ 3PMF IP ϝοηʔδϯά֓ཁ $IBOOFM .FNCFS

    JEFOUJUZ .FTTBHF JEFOUJUZ .FTTBHF JEFOUJUZ .FNCFS JEFOUJUZ $IBOOFM3PMF 6TFS JEFOUJUZ 3PMF 4FSWJDF3PMF ͜Ε
  12. Service Role and Channel Role ֤छ SDK Λ࢖͏ͱɺͲΜͳਓͰ΋ SDK ͷϝιουΛݺ΂͹

    ԿͰ΋Ͱ͖ΔΑ͏ʹͳͬͪΌ͏ͷͰɺͦΕͷରԠɻ Service Role - Channel ͷ؅ཧݖݶͷΑ͏ͳΠϝʔδ - νϟϯωϧ࡞੒ɺϝϯόʔট଴ɺνϟϯωϧࢀՃͳͲ Channel Role - Channel ͷϢʔβʔݖݶͷΑ͏ͳΠϝʔδ - ϝοηʔδૹ৴ɺνϟϯωϧୀࣨͳͲ
  13. IPM SDK or REST API ? REST API γεςϜଆͰϝϯόʔɺνϟϯωϧͳͲΛࢦఆͰ࡞Δ IPM

    SDK ϢʔβʔଆͰࣗ༝ʹνϟϯωϧ࡞੒ɺϝϯόʔ؅ཧΛͤ͞Δ -> ݖݶઃఆ͕ॏཁ Channel, Member, Message ૢ࡞͸ͲͪΒͰ΋Ͱ͖Δɻ ࡞Γ͍ͨαʔϏεʹΑͬͯ࢖͍෼͚Δɻ
  14. Twilio ͷ Queue Queue ͷ଴ͪਓ਺, ઌ಄ίʔϧ৘ใ͸ REST API (Queues/{QueueSid}/Members/Front) Λݺ͹ͳ͍ͱऔͬͯ͜Εͳ͍ʂ

    Problem CallConnect Ͱ͸ɺ௨࿩ͷอཹͱண৴ΩϡʔΠϯάͰ Twilio ͷ Queue Λར༻ɻ
  15. IP ϝοηʔδϯά REST API Ͱ Web ϓογϡ௨஌ 1. ֤Πϕϯτൃੜ࣌ʹ JSON

    ܗࣜͰ REST API ͔Β IPM ϝοηʔδૹ৴ 2. IPM ͔Βड͚औͬͨ৘ใΛϒϥ΢βଆ ͰϦΞϧλΠϜߋ৽