且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

诊断下降通知从Azure的通知中心到APNS

更新时间:2023-12-03 16:53:34

这很可能是你有你的数据库中的一些沙箱设备令牌(我不知道如果该设备令牌存储在您的服务器或在Azure中的通知中心)。当试图发​​送与沙箱设备令牌生产推环境的通知,由Apple返回InvalidToken错误,并且连接被关闭。

It's quite possible that you have some sandbox device tokens in your database (I'm not sure if the device tokens are stored in your server or in Azure Notification Hub). When trying to send a notification with a sandbox device token to the production push environment, an InvalidToken error is returned by Apple, and the connection is closed.

很多时候,通过和所有这一切都是由苹果丢弃发送推送通知到苹果的服务器APN服务器获取错误响应,它已经派出更多的通知(可能与有效令牌)的时间。此时,新的通知由苹果只用APNS一个新连接建立后接受,从而使被无效令牌旧连接后发送的消息需要被重新发送。这是可能的Azure不处理这个正确重新发送。

Very often, by the time the server that sends push notifications to Apple's APN server gets the error response, it has already sent many more notifications (possibly with valid tokens), and all of which are discarded by Apple. At this point, new notifications are accepted by Apple only after a new connection with APNS is established, so messages that were sent after the invalid token to the old connection need to be resent. It is possible Azure don't handle this resending correctly.

正如你所说,在Azure通知中心监控页面显示了一些错误。我怀疑 3 APNS坏信道错误表示无效的设备令牌。我不知道你实际上有多少无效的设备令牌在数据库,但即使过一可能会导致不被苹果接受有效的令牌许多通知。

As you said, the Azure Notification Hub Monitor page shows a few errors. I suspect that 3 APNS Bad Channel Errors means invalid device tokens. I don't know how many invalid device tokens you actually have in the DB, but even one can cause many notifications with valid tokens not to be accepted by Apple.

***的解决方法是测试在数据库中的所有设备令牌并弄清楚,是无效的那些并删除它们。

The best solution is to test all the device tokens in the DB and figure out the ones that are invalid and delete them.