web app how to know “subtype” with GCM in chromium

35 views
Skip to first unread message

hu song

unread,
Apr 9, 2018, 1:46:44 AM4/9/18
to Push Notifications Development
HI All

I am investigating web push API with GCM service in chromium. I can finish push related operation with web test app in blew steps.

1. Web app subscripts( with "serviceWorker" and "pushManager" object) swRegistration.pushManager.subscribe

2. Web app can get browser's response (subscription information)like blew
{"endpoint":"https://android.googleapis.com/gcm/send/Token XXXXX","keys":{"p256dh":"BJT2lL5rKUfvJRE4sAzkuEVP57zEmbiDRiy0a_X7L6BkZfqdlSU9dXM4YX4oUUxf7iRoz7BRGn3r9I35BvzVMuk=","auth":"afnmlAsQ7FfOgHabD5n0Ow=="}}"

3.In chromium side, Browser can receive incoming web push message. Push message has a item "subtype" which value's format like "wp:url#UUID".
I checked chromium source code, UUID is generated by browser side in web app push subscripts process.

My question is : Web app how to know "wp:url#UUID"? Browser doesn't response "wp:url#UUID" to web app in steps 2. So web app can't notify web app server to send push message with subtype member.

Peter Beverloo

unread,
Apr 9, 2018, 3:59:06 AM4/9/18
to hu song, Push Notifications Development
The subtype of a subscription is an internal implementation detail that we use to route the message to the appropriate Service Worker.

The value is not exposed because you don't need it -- all you need is the subscription's endpoint. The subtype will be added implicitly by our push service (GCM) when it forwards a message to your device.

Thanks,
Peter


--
You received this message because you are subscribed to the Google Groups "Push Notifications Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to push-notifications-dev+unsub...@chromium.org.
To post to this group, send email to push-notifications-dev@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/push-notifications-dev/3bab8a7f-c592-49cc-8ba2-e4d480bbc1bb%40chromium.org.

Reply all
Reply to author
Forward
0 new messages