Alec Gorge
Alec Gorge

Reputation: 17390

Multiple HTTP requests vs a single TCP connection on iOS

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 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.

Upvotes: 2

Views: 1460

Answers (1)

NWCoder
NWCoder

Reputation: 5266

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.

Upvotes: 1

Related Questions