我們正在爲我們的移動聊天應用程序使用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