开发者

iPhone / Android realtime communication, XMPP, raw TCP?

开发者 https://www.devze.com 2023-04-05 00:29 出处:网络
I have an app that has 2 versions : 1 on iPhone, 1 on Android. I want my 2 apps to communicate in real time. The use cases are :

I have an app that has 2 versions : 1 on iPhone, 1 on Android.

I want my 2 apps to communicate in real time. The use cases are :

User A sees a friends list, pick a user B and click on "share an item" User B get a notification saying that user A wans to share an item with him User B accepts, the transaction takes place, and both users are notified that it goes well.

I thought about using a simple HTTP transaction, but that would polling for the user therefore not a nice user experience.

I think XMPP would fit nicely, but I'm not quite sure how flexible this solution can be ( wha开发者_C百科t if I want to keep my users information on a separate server also etc. ). I also consider using a raw TCP socket ( Node.js on the server is fairly easy to operate ).

What's the best solution at the moment ?


Well, your requirements are pretty much:

  • Real time
  • Friend list
  • Presence
  • Sharing of data

These are all features of XMPP, and there are library implementation available in multiple languages. Smack for Java and xmppframework for Objective C will cover your particular use case.

You could of course write this yourself from the socket layer up, but why bother when there are existing standardized protocols and libraries available to do what you need. This way when you want to add Blackberry or any other platform to your list, I am sure you can easily find the right library to support your app without having to build from the ground up.

0

精彩评论

暂无评论...
验证码 换一张
取 消