XMPP messages lost on Android while switching data connectivity (e.g. turning Wifi of, GSM <-> Wifi switch)

前端 未结 5 431
无人共我
无人共我 2020-12-30 05:40

I\'m developing a chat application in android. Using XMPP server. PHP server has been migrated to ejabber.

My notification works properly in all scenarios. But in o

相关标签:
5条回答
  • 2020-12-30 05:55

    You should relogin after reconnecting to the internet everytime. But, keep in mind that if you relogin with same resource and same user even it is online then server will throw stream error (replaced by new connection) which will make you offline & you won't receive any message. For this, disconnect yourself properly first before relogin. Try searching on mod Amp module.

    0 讨论(0)
  • 2020-12-30 06:02

    You have to create the separate web service for that. so thus why we can handle the history of the sent message. we can manage the offline message.

    XEP-198 is the only solution. make plugin for your server and make that easy to manage the remain message that is lose. there may be other solution but AFAIK, this would be the solution.

    0 讨论(0)
  • 2020-12-30 06:03

    you can modify archive plugin to save message ids in it.

    When user comes online call a web service with last message id received. server can get all the later messages saved on the server. I created it i the same way and working perfectly well.

    0 讨论(0)
  • 2020-12-30 06:04

    You need "Stream Management" XEP-198 enabled connections to achieve this. Georg wrote a good blog entry about that topic: http://op-co.de/blog/posts/XEP-0198/ Basically it allows for stanza acknowledgement and stream resumption, which is exaclty what you want to do in case of e.g a Wifi <-> GSM switch.

    I conclude from the stacktrace that you are using aSmack (which is Smack ported to Android). There is a open feature request to implement Stream Management in Smack: SMACK-333. In fact, i've recently started working on the implementation, but can't name an ETA.

    0 讨论(0)
  • 2020-12-30 06:12

    So to install mod_archive I need to do this, the typical: Write following line in cmd. (For cent Os)

    Login as root Create new directory:

    mkdir ejabberd_archive_plugin
    cd ejabberd_archive_plugin
    

    now get the latest ejabberd modules using following command

    yum https://svn.process-one.net/ejabberd-modules
    cd ejabberd-modules/mod_archive/trunk
    ./build.sh
    

    Now go to ebin directory using following cmd and get the list of all *.beam files for ejabberd archive plugins.

    root@ns1 [/ejabberd_archive_plugin/ejabberd-modules/mod_archive/trunk/ebin]# ls –l
    

    Using following cmd you will get all ejabberd *.beam files list when ejabberd setup and configure.

    root@ns1 [/usr/lib64/ejabberd/ebin]# ls -l
    

    Now copy all *.beam (archive plugins) files to ejabberd ebin directory using following cmd

    root@ns1 [/]# cp /ejabberd_archive_plugin/ejabberd-modules/mod_archive/trunk/ebin   /usr/lib64/ejabberd/ebin
    

    Now go to following URL and copy all sql table queries and run in phpmyadmin (ejabberd database)

    https://svn.process-one.net/ejabberd-modules/mod_archive/trunk/src/mod_archive_odbc_mysql.sql
    

    Now configure ejjaberd.cfg using following cmd

    root@ns1 [/etc/ejabberd]# vi ejabberd.cfg 
    Add the following line into ejabberd.cfg file in modules configuration section
    {mod_archive_odbc, [{database_type, "mysql"}, {default_auto_save, true}, {enforce_default_auto_save, true}]},
    

    Now restart the ejabberd service.

    root@ns1 [/etc/ejabberd]# sudo service ejabberd restart
    
    0 讨论(0)
提交回复
热议问题