XMPP ejabberd SaaS 推送通知 [英] XMPP ejabberd SaaS Push Notifications

查看:25
本文介绍了XMPP ejabberd SaaS 推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对我之前的问题的更新,XMPP 推送通知导致问题.

This is an update to my previous question, XMPP push notifications causing problems.

感谢 Mickaël Rémond 的回答,延迟和重复问题已经消失,但我仍然无法理解推送通知的行为.

Thanks to the answer from Mickaël Rémond delay and duplication issues are gone but I still fail to understand the behaviour of push notifications.

  1. 如果我将应用程序移至后台(不锁定设备或终止),它将不会收到任何推送通知,而当我将其移回前台时,所有消息都会完美接收.

  1. If I move the app to background (without locking device or termination) it won't receive any push notifications, and when I bring it back to foreground all the messages are received perfectly.

当应用程序在前台并且我锁定设备时,不会触发任何通知,但可以完美接收消息.

When the app is in foreground and I lock the device, no notifications are triggered but messages are received perfectly.

当应用程序在后台并且我锁定设备时,会触发通知,可以完美接收消息,但有时在发送sendLastActivityQueryToJID后会收到消息.

When the app is in background and I lock the device, notifications are triggered, messages are received perfectly but sometimes messages are received after sending sendLastActivityQueryToJID.

我不知道这里发生了什么,但如果你们有任何想法,请告诉我.
PS 我已经从我的应用程序中删除了后台模式.

I don't know what's going on here but if you guys have any idea please let me know.
PS i have removed Background modes form my app.

推荐答案

它似乎与 ejabberd 没有任何关系,但似乎与推送通知在 iOS 上的工作方式有关.

It does not seem to have anything to do with ejabberd but seems related to how push notification works on iOS.

我不完全确定您要做什么,但您不应删除应用的后台模式.无需这样做,并且允许应用在后台模式下运行一小段时间,以执行适当的内务管理任务,还有许多其他好处.

I am not totally sure what you are trying to do but you should not remove background mode for your app. There is no need to and there is many other benefit in allowing the app to run for a short while in background mode, to do proper house keeping tasks.

  1. 后台的应用程序通常会在被杀死之前运行三分钟.这意味着在此期间您会​​在应用程序内收到正常的 XMPP 消息.您必须在该状态下并在收到 XMPP 消息时触发来自 appm 的本地通知.

  1. App in background usually run for three minutes before being killed. It means during that time you receive normal XMPP message inside the app. You have to trigger local notification from the appm in that state and upon receiving an XMPP message.

当应用程序在前台时,iOS 永远不会显示任何通知.这是意料之中的.如果您连接在 XMPP 服务器上,您将收到 XMPP 消息.如果未连接,您将收到通知,但不会显示.您可以在您的应用中对它们进行处理.

When app is in foreground, iOS will never display any notification. This is expected. If you are connected on the XMPP server, you will receive XMPP message. If not connected, you will receive notification, but they will not be displayed. It is up to you to do something with them in your app.

您对您的问题有些困惑:如果您的应用程序在后台,则会触发通知,但只有在您重新打开/重新连接到会话或重新连接时,才会同时收到消息.如果你需要一些流量来接收消息,那是因为你没有做空白保持活动.如果你不这样做,服务器会认为你突然失去了连接并开始发送推送通知和缓冲消息.确保按照文档中的建议实现空白保持活动,否则无法正常工作.

You have some confusion in your question: If you app is in background, notifications are trigger, but message should not be receive at the same time only when you reopen / reattach to session or reconnect. If you need some traffic to receive messages, it is because you are not doing whitespace keep alive. If you do not do that, the server will think you suddenly lost the connection and will start sending push notification and buffering messages. Make sure you implement whitespace keep-alive as recommended in the document as otherwise it cannot work fine.

这篇关于XMPP ejabberd SaaS 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆