Google Cloud Pub/Sub API - Push E-mail

落花浮王杯 提交于 2019-11-29 09:56:21

TL;DR

Your cannot subscribe to push notifications from the client side.


Set up an HTTPS server to handle the messages. Messages will be sent to the URL endpoint that you configure, representing that server's location. Your server must be reachable via a DNS name and must present a signed SSL certificate. (App Engine applications are preconfigured with SSL certificates.)

Just subscribe to the push notifications on your server, and when you get the notification, you can figure out who it concerns. The data you will get from the notifications is what user that it concerns, and the relevant historyId, like so:

 // This is all the data the notifications will give you.
 {"emailAddress": "user@example.com", "historyId": "9876543210"}

Then you could e.g. emit an event through Socket.io to the relevant user if he is online, and have him do a sync with the supplied historyId on the client side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!