我们正在为我们的移动聊天应用程序使用ejabberd服务器。 我们正在为我们的IOS应用程序使用IOS XMPP框架(https://github.com/robbiehanson/XMPPFramework)从XMPP获取离线消息而无需成为在线
但是我们在执行时遇到问题,我们无法找到解决方案。 我们已经实现了XMPP消息传递的各个方面,除了一件事情之外,所有作品都很好:
虽然我们的应用程序是在后台,但我们的ejabberd服务器向我们发送推送通知以通知我们有关脱机消息。 (仅针对离线消息发送通知)
然后,我们决定实施IOS后台推送通知功能,以在应用程序处于后台时获取脱机消息。
但问题是我们必须成为在线(发送状态)以获取离线消息。 但是,当我们这样做,它创建了2个不良后果:
- 谁发送消息看到我们的存在为在线(尽管我们是在后台)
- 只是因为我们正在成为网上同时申请的一方由于我们处于在线状态,服务器只能发送离线消息通知,因此我们的服务器无法发送其他人消息的推送通知。
为了解决这个问题,只有我能想到的是,如果有办法从xmpp服务器上检索离线消息而不上网。 有谁知道,如果有没有办法做到这一点与XMPP的框架IOS
[编辑] 让我澄清一下这个问题有点多:
问题不仅仅是多了一个:
问题1 - 推送通知的问题:
1.1 - Server check if the message is sending to an online or offline user. If the user is offline server sends push notification to inform user but if the user is online server doesnt send anything.
1.2 - When the application is in background and receive notification for offline messages, application become alive(still in background) and become online in order to get offline messages
1.3 - Because the client became online, server doesnt send the push notifications anymore but the application is still in background so the user cannot be informed about the message he/she received.
因此为了解决这些我需要找到一种方法,通过不发送接收离线消息的问题网上存在服务器
问题2 - 信息接收问题
2.1 - Server check if the message is sending to an online or offline user. If the user is offline server sends push notification to inform user but if the user is online server doesnt send anything.
2.2 - When the application is in background and receive notification for offline messages, application become alive(still in background) and become online in order to get offline messages
2.3 - When the application became online server sends all offline messages to client but doesnt send the total count of offline messages(At least I cannot get it with IOS XMPPFramework)
2.4 - So I dont know how much longer the client should stay alive in the background because I dont know the total count of offline messages, so after getting 2-3 messages I have to suspend the application in the background. But in that case there might be buggy situations such as XMPP Framework receive the offline message but I suspend the client application before writing it to database etc...
为了找到解决这些问题:
- 我需要找到一种方式来获得唯一1离线消息当我想从服务器
- 如果可能我还需要得到这些离线消息,而不会变成在线
有关这个问题的任何想法? – tolgatanriverdi