TCP-based RPC server (Erlang or something similar?) for iOS/Android app communication

前端 未结 6 1579
清酒与你
清酒与你 2020-12-23 17:15

I\'m building native mobile applications in both iOS and Android. These apps require \"realtime\" updates from and to the server, same as any other network-based application

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 18:04

    It all depends on what data you are sending - the size of it, the criticality of timeliness, frequency of update etc.

    If you are looking for a reasonably lazy update and verbose data (JSON say) then go with a HTTP comet pattern, as you will find it much easier to navigate standard network gear as other answers have highlighted. If you are behind a corporate firewall/proxy for example, http will be a much safer bet.

    However, if you are doing fast things with small data sizes then go with something homegrown and leverage a TCP connection. It's much more to the point and you'll find the performance in real terms much better. Simple data structures and use fast operators to slice you data up as you need it.

    Again as other posters have noted, battery usage is a big concern. You will eat a battery by literally burning a hole in your pocket if you are not careful. It is very easy to turn a battery that lasts 2 days into one that will last 6hours.

    Lastly, don't trust the network if you are time sensitive. If you are not then a long poll over HTTP will be just fine for you. But if you are looking for high performance messaging, then be acutely aware that a mobile network is not an end-to-end TCP connection. Your requests will varying in trip time and latency.

    So back to what you want to do with the app. As you are building for iOS (native obviously dictated) and Andriod, I would leverage Apple Push Services and their notification framework. Build you back end services to talk to that and also provide interfaces for non-apple devices (i.e. http or tcp level listeners). That way one platform and multiple 'gateways' for your apps. You can then do RIM via their push service too if you wanted to.

提交回复
热议问题