我们是否应该使用openfire的GCM(或新的FCM)离线pushnotification消息? [英] Should we use GCM (or new FCM) with openfire for offline pushnotification messages?

查看:239
本文介绍了我们是否应该使用openfire的GCM(或新的FCM)离线pushnotification消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



第一种方式


$ b这个接口就像在聊天应用程序中工作一样,使用openfire和smack可以有两种方式$ b


  1. Smack与openfire服务器建立连接,只要连接到openfire服务器,它就可以接收和发送更新到服务器。在没有连接的情况下,在openfire上的一个插件将消息保持在离线状态,一旦客户端重新连接,就会发送它们。
    在这种情况下接收所有消息,


    • 1.1设备应该只与openfire断开连接,如果没有的话互联网。
    • 1.2用户注销

    • 1.3设备处于离线状态


      如果连接在任何其他情况下与服务器断开连接,则会导致消息丢失。

    • $ b

      • 这个主要的问题是,如果由于任何崩溃,或问题应用程序被完全杀死,而且它的警报管理器任务也被终止。应用程序在应用程序再次打开之前不会重新启动。
      • 第二个问题是,由于连续进程而消耗电池

      • 在更新的操作系统应用程序进入深度睡眠,打盹模式,ulta省电模式,后台


        第二种方式

        2.Smack与openfire服务器建立连接,只要连接到openfire服务器,它就可以接收和发送更新到服务器,直到应用程序处于前台。一旦这在后台进行,应用程序将完全断开与服务器的连接。在这种情况下,当应用程序处于离线状态时,openfire必须将所有消息发送到Firebase服务器,同一个应用程序将侦听Firebase通知,并在Firebase收到来自Firebase的通知时,重新连接到openfire并获取消息并直接显示或显示消息从firebase(在这种情况下,这个记录也进入firebase服务器)。应用程序收到来自gcm的通知,然后需要在应用程序中管理消息传递等。

        问题




        • 当应用程序进入背景时断开与服务器的连接,处理其应用程序,因为应用程序在后台很长一段时间。是应用程序在后台选择任何文件和用例这样。

        • 这使得代码和应用程​​序非常强大,也需要管理多个服务器。

        • 由于我不想与任何第三方共享我的应用程序消息数据,因此也可能会有更多的安全漏洞。



        我的问题




        1. 更好,更安全,更可靠的使用?

        2. 我的应用程序使用方式1,我应该切换到第二种方式吗?原因,以确保应用程序保持连接在每一个方面?并且它消耗更少的电池呢?


        解决方案

        更可靠的使用?
        A:第二种方式

        2-我的应用程序使用方式1,我应该切换到第二种方式吗?
        答:你应该显然需要Openfire的技能来开发一个将消息发送到FCM的插件。

        3-可能的原因是什么确保应用程序保持连接在每一个方面?而且它也消耗更少的面糊?
        A:简单地说,如果我们减少XMPP流量,可以节省处理能力,从而减少电池消耗。但是,显然对于聊天应用程序,这不会是选项。所以为了保持应用程序的交互性和电池的友好性,当应用程序进入后台并依赖推送通知(服务器端的集成)时,应该断开XMPP。


        It seams like to work with chat application, using openfire and smack there can be two ways below,

        First Way

        1. Smack makes a connection with the openfire server and it can receive and send updates to the server as long as its connected to the openfire server. In case its not connected, theres a plugin on openfire which keeps the messages offline, and send them once the client is connected again. In this scenario to receive all messages,

          • 1.1 Device should only disconnected from the openfire in case if it don’t have internet.
          • 1.2 User is sign out
          • 1.3 Device is offline

          If connection goes disconnected with the server in any other case this cause messages loss. Currently application is working with this architecture.

        Problems with this method:

        • The major problem for this is if due to any crash, or problem application gets completely killed, and its not alarm manager task also gets killed. App didn’t restart until the application opens again.
        • Second problem with this is, its consuming battery due to continuous process
        • On updated OS application goes in deep sleep, doze mode, ulta power save mode, background

        Second Way

        2.Smack makes a connection with the openfire server and it can receive and send updates to the server as long as its connected to the openfire server until the application is in foreground. As soon as this goes in background the application will completely disconnect from the server. In this case as application is offline openfire have to send all the messages to the Firebase server, same application listens for the firebase notifications and when it receives the notification from firebase it reconnects to the openfire and gets the message and display or shows the message directly from firebase (in this case this record goes to the firebase server as well). Application receives that notification from the gcm and then need to manage in application about message delivery etc.

        Problems

        • Disconnect from server when app goes in backgound, handle its usecases as app is in background for long time or not. Is app goes in background to select any file and use cases like this.
        • This makes the code and application very compelex and need to manage multiple servers as well.
        • There can also be more security breaches as i don't want to share my application messages data with any third party.

        My Questions

        1. Which way is better, secure and more reliable to use?
        2. My application is working with way 1, should i switch to second way ?
        3. what can be possible reasons to make sure that app stays connected in each and every way? and it consumes less batter as well?

        解决方案

        1- Which way is better, secure and more reliable to use? A: Second Way

        2- My application is working with way 1, should i switch to second way ? A: You should but obviously that would require Openfire skills to develop a plugin which will route messages to FCM.

        3- what can be possible reasons to make sure that app stays connected in each and every way? and it consumes less batter as well? A: Simply said, if we reduce XMPP traffic, processing power can be saved and as a result reduction in battery consumption. But obviously for a chat application, that won't be the option. So for keeping the application interactive and battery friendly you should disconnect XMPP when app goes to background and rely on Push notifications (integration on server side).

        这篇关于我们是否应该使用openfire的GCM(或新的FCM)离线pushnotification消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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