So... I'm making an application for Android. The application needs to send and receive realtime chat data (needs to be a socket) but it also needs to send commands (which don't as the client knows when it is sending something).
I need to know what is a better solution in terms of saving the user's battery.
a) Opening and Closing the connection every time a command is sent, if the chat tab is opened then keep the connection constant.
b) Keep the connection constant all the time.
I've taken a look around the internet but have gotten mixed answers, some say keeping a persistent connection is bad for battery life and others say that it isn't (Example: "Are you asking if holding a TCP connection open will drain battery-life? Maybe I am WAY off here but, holding a connection open shouldn't waste battery life... If you think it will I would love to know where you got that information. It sounds SO strange to me.")
Or if there is another solution that would be better. I don't think that Google's C2DM would be very useful at all in this situation either.
Basically, what drains the battery more: having a persistent connection, or opening and closing the connection unless the chat tab is open?
Thanks!