Will the iPhone battery be affected by the open TCP connection and not send or receive data?

I am currently developing a chat client for iphone. On the server side there is node.js with Socket.IO, and on the iPhone there is a Socket.IO client ( https://github.com/DanLite/socket.IO-objc )

My question is: Will the iPhone battery be affected by an open TCP connection and will not send or receive data in 3-4 minutes?

What is better for a battery? Persistent tcp connection or multiplication of HTTP requests.

thanks

Edit: I have chat + other functions, such as (change name, check friends status, edit settings)

Edit 2: Looks like WhatsApp is doing this with tcp connection

+4
source share
1 answer

When the TCP connection is open, both sides have information about this (remote ip: port, local ip: port). This information is a simple data structure in memory. Until an RST packet or timeout is received, the connection is considered open.

When you send connection data, you start to consume the processor and force the base wireless mobile network module to send a signal, therefore, consume the battery.

That's why it's better to maintain a TCP connection as long as possible and prefer batch chatting (combine multiple application messages).

On the other hand, you should be prepared for a situation where network coverage is poor and you have to constantly open a TCP connection, thereby consuming battery power.

+4
source

Source: https://habr.com/ru/post/1390396/


All Articles