2

我在 PubNub 文档中找不到任何 api 来列出与频道关联的设备令牌。我计划将用户关联到他们各自的频道,并将他们的设备令牌直接链接到这些频道,这样如果同一个用户从不同的设备登录,他们就会收到所有针对他们的推送通知,就像从服务器端一样,我们会在频道上发布更改。但是现在在稍后的某个时间点,我们可能需要检索与这些通道关联的设备令牌,该怎么做呢?

到目前为止,我们不打算在我们的应用服务器上存储设备令牌,以为我们会通过渠道从 PubNub 中检索它,但我们找不到任何相关的 api。

请帮助,如果设计不正确,请告诉我们。

谢谢!

4

1 回答 1

2

PubNub Mobile Push Gateway - Device Token/Channel Lookup

PubNub does not currently provide a way to get device tokens for a given channel because this is considered unsecure. If you (whoever you is: client device, server, third party, etc.) should either know the device token or not. If you can not get the device token by some valid/legitimate means, then you should not be able to get by some other means (like by PubNub channel association).

What you can do is have the device POST its token to your server along with a list of PubNub channels it should register to for push notifications and store them in your database and maintain that list as these device token/channel associations change.

You can always list the channels for a given device using the SDK's specific API:

Or use this REST API:

http://pubsub.pubnub.com/v1/push/sub-key/your_sub_key/devices/your_device_token?type=push_type

where push_type is gcm, apns or mpns.

于 2016-02-12T23:35:33.127 回答