PWAでPush通知を受け取るぞ

2ae6ecc3386b5264385082c166f3a319?s=47 tmtysk
August 29, 2018

 PWAでPush通知を受け取るぞ

"第1回ゆるはち.it: PWAについてゆるく話す" https://yuruhachi-it.connpass.com/event/96878/ でお話した内容です

2ae6ecc3386b5264385082c166f3a319?s=128

tmtysk

August 29, 2018
Tweet

Transcript

  1. 18"Ͱ1VTI௨஌Λ ड͚औΔͧ !UNUZTL

  2. ݴ͍͍ͨ͜ͱ ˘ɹ18"Ͱ1VTI͢ΔͳΒɺ8FC1VTIΛ࢖͍·͠ΐ͏ ˘ɹJ04ͷ18"Ͱ͸ɺ8FC1VTIରԠ͍ͯ͠·ͤΜ ˘ɹ͍·͔Β8FC1VTI΍ΔͳΒ7"1*%͔͍ͭ·͠ΐ͏ ೥݄࣌఺

  3. 8FC1VTI w 8FCٕज़Λ࢖ͬͨʮΤϯυϢʔβʹɺϦΞϧλΠϜʹΠ ϕϯτΛಧ͚Δʯ͘͠Έ w ݩʑ͸*&5'͕l8FCQVTIzͱ͍͏໊લͷ1SPUPDPMʹͭ ͍ͯ1SPQPTBMΛग़͍ͯͨ͠ ֤ॴͰදهʹΏΒ͗͋Γ  w

    8$͕ɺ"1* 1VTI"1* ࢓༷Λࡦఆத w ʮ8FCϖʔδΛݟ͍ͯͳͯ͘΋ɺ௨஌Λಧ͚ΒΕΔʯ w ͜ͷ࢓༷ʹରԠͨ͠ϒϥ΢βͱͯ͠ɺ$ISPNF 'JSFGPY  &EHF 4BGBSJ͕͋Δ IUUQTFOXJLJQFEJBPSHXJLJ1VTI@UFDIOPMPHZ8FCQVTI
  4. 1VTI"1* w 8$Ͱ࢓༷ࡦఆத 8PSLJOH%SBGU IUUQTXXXXPSH53QVTIBQJ The Push API enables sending

    of a push message to a webapp via a push service. An application server can send a push message at any time, even when a webapp or user agent is inactive. The push service ensures reliable and efficient delivery to the user agent. Push messages are delivered to a Service Worker that runs in the origin of the webapp, which can use the information in the message to update local state or display a notification to the user. This specification is designed for use with the web push protocol, which describes how an application server or user agent interacts with a push service.
  5. 18"ͱ͍͑͹ɺ 4FSWJDF8PSLFS

  6. 18"Ͱ1VTI΍ΔͳΒ 8FC1VTI

  7. ݴ͍͍ͨ͜ͱ ✔ɹ18"Ͱ1VTI͢ΔͳΒɺ8FC1VTIΛ࢖͍·͠ΐ͏ ˘ɹJ04ͷ18"Ͱ͸ɺ8FC1VTIରԠ͍ͯ͠·ͤΜ ˘ɹ͍·͔Β8FC1VTI΍ΔͳΒ7"1*%͔͍ͭ·͠ΐ͏ ೥݄࣌఺

  8. ͱ͜ΖͰɺϒϥ΢βରԠ͸ʁ IUUQTDBOJVTFDPNGFBUQVTIBQJ

  9. ͋Εɺ4BGBSJ͸ʜ

  10. 4BGBSJ͸l1VTI"1*ʹ͸zະରԠ ࠶ܝ IUUQTXXXXPSH53QVTIBQJ

  11. Ͱ΋ɺJ04Ͱ18" Ͱ͖ΔΑ͏ʹͳͬͨͷͰ͸ʁ

  12. 18"Ͱ͖Δ㱠1VTIͰ͖Δ IUUQTNFEJVNDPN!pSUQSPHSFTTJWFXFCBQQTPOJPTBSFIFSFEEFFB

  13. 18"POJ04Ͱͷ1VTI͸ ͍·͸ ͖͋ΒΊ·͠ΐ͏ 1VTIͳͯ͘΋ɺϝϦοτ͋ΔΑʂ ͨͿΜ

  14. ݴ͍͍ͨ͜ͱ ✔ɹ18"Ͱ1VTI͢ΔͳΒɺ8FC1VTIΛ࢖͍·͠ΐ͏ ✔ɹJ04ͷ18"Ͱ͸ɺ8FC1VTIରԠ͍ͯ͠·ͤΜ ˘ɹ͍·͔Β8FC1VTI΍ΔͳΒ7"1*%͔͍ͭ·͠ΐ͏ ೥݄࣌఺

  15. ͱΓ͋͑ͣɺ΍ͬͯΈ͍ͨʂ

  16. 1VTI"1*ͷߏ੒ཁૉ w 8FCBQQ w 1VTINFTTBHF w 1VTITVCTDSJQUJPO w 1VTITFSWJDF w

    1FSNJTTJPO IUUQTpSFCBTFHPPHMFDPNEPDTDMPVENFTTBHJOH IMKBIPX@EPFT@JU@XPSL
  17. 1VTI4FSWJDFʜ

  18. ֤ϒϥ΢βʹରԠͨ͠1VTI4FSWJDF͕͋Δ w $ISPNFˠ'JSFCBTF$MPVE.FTTBHJOH '$.  w &EHFˠ8JOEPXT/PUJpDBUJPO4FSWJDF 8/4  w

    'JSFGPYˠ.P[JMMB1VTI4FSWJDF .14  w 4BGBSJˠ"QQMF1VTI/PUJpDBUJPO4FSWJDF "1/T ˢͱ͘΂ͭͳࢠ
  19. ϒϥ΢βผʹʜରԠʜ ΊΜͲ͍͘͞ࣄҊͰ͸ʜ

  20. ͦ͜ʹɺ7"1*% w 7PMVOUBSZ"QQMJDBUJPO4FSWFS*EFOUJpDBUJPO w *&5'͕औΓܾΊͯ͘Εͨೝূˍ1VTIར༻ํࣜ w ର޲͢Δෳ਺छྨͷ1VTI4FSWJDF ͷ޲͜͏ʹ͋Δෳ਺ छྨͷϒϥ΢β ΛɺಉҰखॱͰར༻Ͱ͖Δ

    w 1VTI4FSWJDF͝ͱʹϓϩδΣΫτΛࣄલొ࿥͢Δඞཁ΋ ͳ͘ͳͬͨ IUUQTUPPMTJFUGPSHIUNMSGD
  21. IUUQTNFEJVNDPNTFFEEJHJUBMVTJOHWBQJEGPSXFCQVTIOPUJpDBUJPOTJOBSVCZPOSBJMTBQQMJDBUJPOFFBFBC ίίΛըҰతʹ ѻ͑ͯ͏Ε͍͠

  22. %FNP

  23. IUUQTHJUIVCDPN.JOJTIMJOLXFCQVTIQIQFYBNQMF

  24. None
  25. IUUQTHJUIVCDPNTFBSDI RXFCQVTI

  26. ݴ͍͔ͨͬͨ͜ͱ ✔ɹ18"Ͱ1VTI͢ΔͳΒɺ8FC1VTIΛ࢖͍·͠ΐ͏ ✔ɹJ04ͷ18"Ͱ͸ɺ8FC1VTIରԠ͍ͯ͠·ͤΜ ✔ɹ͍·͔Β8FC1VTI΍ΔͳΒ7"1*%͔͍ͭ·͠ΐ͏ ೥݄࣌఺

  27. ͠Ό΂ͬͨਓ w !UNUZTL ൃԻͰ͖ͳ͍  w ిؾ௨৴ࣄۀऀ΍։ൃձࣾͳͲΛܦͯɺ͜͜ʹ͍·͢ w 5VNCMSͱ/HJOY͕޷͖Ͱ͢ w

    ϓϩάϥϛϯάݴޠσϏϡʔ͸#"4*$ɺशͬͨͷ͸1BTDBM w ͍ͪ͹Μ௕͘ॻ͍ͨͷ͸1)1ɺ͕࣍3VCZ͔+BWB w ٕज़ͷ࿩ͱɺγϯϓϧͰ୺తͳ΋ͷͱɺࣳډͱɺ
 ͋ͱɺͳΜ͔Χοί͍͍΋ͷ͕޷͖Ͱ͢ IUUQTUNUZTLHJUIVCJP
  28. ͋Γ͕ͱ͏͍͟͝·ͨ͠