Xmpp in Android with php server
I am developing an app in which there is a chatting functionality also , except chat my rest app is done now i want to integrate chat in my app for which i am trying xmpp , i have tried a sample for xmpp with my own jabbered server and its working. Following are my question are 1.How to integrate my app php data with jabbered server to show list of user chatting with there image , name , time and last message like the whats app chat list etc. like the image below
2.Flow of xmpp , like how its works example first the message is sent to FCM then to jabbered server and then to Device or it works differentely.
Any suggestion , link , example will be appreciated Thanks.
I think you are asking a lot of questions at once. The way you want to implement it all with your server depends on you. But the best I can say to my own knowledge is that chat storage on WhatsApp is done on the device. Messages can be stored in an Sqlite database. I use node.js to power my own server. It's not possible for me to give you the full detail of how it all links together but I can try by saying I have an xmpp client on my Node.js server. Once a user registers the xmpp client is made to register the user in the ejabbered server also with the same username. So since the user info is in the table with all of his/her details they can easily be queried for by username from the Android app.
You need to do some research on xmpp, and maybe Node.js and SQLite.
FCM is something different and you might not really need it in the flow
first sorry for my poor English. Answer for 1st,
XMPP Provides Register using PHP Service. Basically, Register from your device if successfully then register save user data in your server database. after register user you have to register user in XMPP, right now i don't have PHP snidest code.
other way is if user successfully register then it will give you register data. Take user id as register user in XMPP from your device.
i don't know how you manage your friend list but suppose you have user id using it concatenation suffix name with it you can send message.
Answer for 2nd,
You need refer document and make message format in XML and/or son . in Message format you have to define sender id, receiver id, sending time, message and you can define your custom attribute. sender send message in XML format and receiver evaluate message.
Answer for 3rd,
You have manage local database for individual chat because it server work is over after delivering message to you. In group it will provide history message but here also you have to manege local it's database.
hope this information help you.
链接地址: http://www.djcxy.com/p/16826.html上一篇: 我可以在mqtt服务器上编辑消息吗?
下一篇: Android中的Xmpp与PHP服务器