Pusher Beam 停止私人通知但保留 public 条通知
Pusher Beam stop private notifications but keep public notifications
我有一个带有 Public 博客和私人后端的网站。登录与否,用户可以决定接收关于博客的浏览器通知,这是一个 interest https://pusher.com/docs/beams/getting-started/web/sdk-integration#subscribe-to-an-interest
效果很好
const beamsClient = new PusherPushNotifications.Client(
{
instanceId: '...'
});
beamsClient.start().then(() => beamsClient.addDeviceInterest('Blog'));
如果他对通知回答“是”,Pusher 将保存他的 DeviceId
,这很好。现在,当他登录到我的私人后台时,他将能够直接接收到他的通知 https://pusher.com/docs/beams/guides/publish-to-specific-user/web。
这也很好用
const beamsTokenProvider = new PusherPushNotifications.TokenProvider(
{
url: '...'
});
const beamsClient = new PusherPushNotifications.Client(
{
instanceId: '...'
});
beamsClient.start().then(() => beamsClient.setUserId('MY_USER_ID', beamsTokenProvider));
问题:
当用户决定注销时,我从 Pusher Beam (https://pusher.com/docs/beams/reference/server-sdk-php#-deleteuser) 中删除了他的认证设备,我的 objective 只是为了阻止他接收私人认证通知,但它正在删除完全是他的 Pusher 设备,这意味着 Public 博客通知不再有效。
函数deleteUser
的描述是明确的:
Remove the given user (and all of their devices) from Beams. This user
will no longer receive any notifications and all state stored about
their devices will be deleted.
从我删除用户的那一刻起,我就开始在控制台接收:
Uncaught (in promise) Error: Unexpected status code 404: Not found,
Device not found
如何停止私人通知但保留 Public 通知?
已解决.
我没有使用deleteUser
PHP 函数,而是在注销时使用clearAllState
JS 函数。
https://pusher.com/docs/beams/reference/web#-clearallstate
Clears all the state in the SDK, leaving it in a empty started state.
You should call this method when your user logs out of the
application.
这样只有私人通知被清除,Public 通知仍然有效。
我有一个带有 Public 博客和私人后端的网站。登录与否,用户可以决定接收关于博客的浏览器通知,这是一个 interest https://pusher.com/docs/beams/getting-started/web/sdk-integration#subscribe-to-an-interest
效果很好
const beamsClient = new PusherPushNotifications.Client(
{
instanceId: '...'
});
beamsClient.start().then(() => beamsClient.addDeviceInterest('Blog'));
如果他对通知回答“是”,Pusher 将保存他的 DeviceId
,这很好。现在,当他登录到我的私人后台时,他将能够直接接收到他的通知 https://pusher.com/docs/beams/guides/publish-to-specific-user/web。
这也很好用
const beamsTokenProvider = new PusherPushNotifications.TokenProvider(
{
url: '...'
});
const beamsClient = new PusherPushNotifications.Client(
{
instanceId: '...'
});
beamsClient.start().then(() => beamsClient.setUserId('MY_USER_ID', beamsTokenProvider));
问题:
当用户决定注销时,我从 Pusher Beam (https://pusher.com/docs/beams/reference/server-sdk-php#-deleteuser) 中删除了他的认证设备,我的 objective 只是为了阻止他接收私人认证通知,但它正在删除完全是他的 Pusher 设备,这意味着 Public 博客通知不再有效。
函数deleteUser
的描述是明确的:
Remove the given user (and all of their devices) from Beams. This user will no longer receive any notifications and all state stored about their devices will be deleted.
从我删除用户的那一刻起,我就开始在控制台接收:
Uncaught (in promise) Error: Unexpected status code 404: Not found, Device not found
如何停止私人通知但保留 Public 通知?
已解决.
我没有使用deleteUser
PHP 函数,而是在注销时使用clearAllState
JS 函数。
https://pusher.com/docs/beams/reference/web#-clearallstate
Clears all the state in the SDK, leaving it in a empty started state. You should call this method when your user logs out of the application.
这样只有私人通知被清除,Public 通知仍然有效。