开发者

Multiple HTTP requests vs a single TCP connection on iOS

开发者 https://www.devze.com 2023-02-25 14:05 出处:网络
I am developing an iPhone app that uses a web based API that I control. Would it be faster or more efficient to connect to a constantly open TCP port and make 开发者_JAVA技巧requests via the TCP API,

I am developing an iPhone app that uses a web based API that I control. Would it be faster or more efficient to connect to a constantly open TCP port and make 开发者_JAVA技巧requests via the TCP API, or make a new HTTP request for all the data that I want to fetch?

I am imagining that the different would be negligible, but I could be wrong.

New data is fetched pretty much every time a new view is loaded, so requests can happen fairly frequently.


I think the difference would be minimal.

It is also worth noting that NSURLConnection supports the HTTP Keep Alive connections by default, so you could go straight HTTP and make sure your server is allowing the client to keep the connection alive.

0

精彩评论

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