Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Webプッシュ通知触ってみた
Search
matumoto
February 22, 2023
Technology
53
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webプッシュ通知触ってみた
2023/2月に行われたサークル内追い出しLTの資料です
イベントページはこちら
https://zli.connpass.com/event/275487/
matumoto
February 22, 2023
More Decks by matumoto
See All by matumoto
Go標準パッケージのI/O処理をながめる
matumoto
0
520
testingを眺める
matumoto
1
230
sync/v2 プロポーザルの 背景と sync.Pool について
matumoto
0
840
Goトランザクション処理
matumoto
1
97
いまいちどスライスの 挙動を見直してみる
matumoto
0
430
Go1.22のリリース予定の機能を見る
matumoto
0
100
GoのUnderlying typeについて
matumoto
0
250
Typed-nilについて
matumoto
0
400
GoのType Setsという概念
matumoto
0
66
Other Decks in Technology
See All in Technology
アカウント統制の健康診断
kenichinakamura
1
200
freeeにおける AI を用いた ブラウザ動作確認の自動化の取り組み
freee
PRO
0
220
DevelopersIO 2026 Tokyo 現時点の衛星通信サービスの現状を整理してみる
maroon1st
0
310
僕のハーネスを紹介します
watany
6
1.6k
"計画的無茶振り"を通してAIネイティブ世代の新人を育てる
subroh0508
1
110
背中から、背中へ ー 社外コミュニティで学んだ「雑に背中を押す」という恩送り ー / easygoing encouragement and pay forward to community
naitosatoshi
0
320
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
200
1週間、Opus封印でお願いします
kintotechdev
0
170
AIエージェント時代、Kaggleにどう取り組むか
takanao
1
190
VLA-JEPA: Enhancing Vision-Language-Action Models with Latent World Models
takmin
0
330
野良MCPサーバーを排除せよ!MCPサーバーのガバナンス
yukiogawa
1
240
契約で守るコンパウンドプロダクトのデザインシステム
yug1224
1
1.4k
Featured
See All Featured
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
650
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
410
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
290
Transcript
Webプッシュ通知 触ってみた 追い出しLT 2023/02/22
• 学年:28期 • 所属:会津大学コンピュータ理工学部 • 今興味のある技術:Go, Haskell, Rustで競プ ロ •
趣味: ◦ モンハン ▪ 燃えないゴミはもう無いんだよ ◦ イカᔦꙬᔨ ◦ FGO ▪ 2部7章良かったね • Twitter:@matumoto_1234 matumoto 松本 響輝 自己紹介
今回触ってみた技術 • Webプッシュ通知
FirebaseCloudMessaging(FCM)の概要 • Firebaseサーバーに送り先を登録する • Firebaseサーバーから送り先に対してプッシュ通知を送る
送り先の登録処理 • デバイスで登録をする場合
送り先の登録処理 • ブラウザで登録する場合
送り先の登録処理 • では何に登録させるか? ◦ サイトごとに一意なものに登録させる( PushSubscriptionが発生する) ◦ Firebaseが用意しているSDKでmasseging.getToken(**省略*/)を呼び出す と登録トークンがFirebase側で発行されて返される(2回目以降はキャッシュされたも のが返される)
送られるとどうなるか • 送り先がサイトごとに一意 ◦ じゃあサイトを開いていないときとかは通知が来ないのでは? ◦ →ちゃんと来てくれる ▪ ServiceWorkerが受け取っている ServiceWorker
通知許可
ServiceWorkerについて • ServiceWorker発火などでなんらかの動作をしたい ◦ ServiceWorkerAPIが実は提供されている
実際に送るには • FirebaseConsoleからプッシュ通知を送ることができる • Firebase Admin SDKからも同じように送れる
実際に送るには • Firebase Admin SDKを使うメリット ◦ アプリのサーバー側から通知を叩ける
実装編
実装 • Firebaseプロジェクトを作って、生成されるサーバーキーとかを保管 • firebase-toolkitsをPCにインストール • $ firebase initとかをして生成されるindex.htmlなどのファイルに、さっきのサーバー キーとかをコピペ
• $ firebase serve でローカルファイルをホスティング • ホスティングしたlocalhost:5000とかに行って通知を許可 • FirebaseConsole(Web画面)から通知を送る • AC
デモ
ご卒業 おめでとうございます! 社会人になっても健康でいやがれください