Does apps like fb keep an open socket for the entire time the app is open to fetch stories and posts. What are the pros and cons of this approach
Apple JobsAtAppFeb 3, 2019
It does for stories and messenger. They constantly heart beat on this connection. Even iOS keeps socket open for notifications.
Benefits are no long polls or continuously checking server. Drawback could be little waste of networking on heartbeat.
Microsoft NeganFeb 3, 2019
Other drawback is power burn.
Microsoft undefinedFeb 5, 2019
Nah, keeping an open socket with no traffic is well optimized these days. As @JobsAtApp said, the OS does this for push notifications all the time anyway, so the radio is already active just enough for that. If youโre actually receiving things, or doing less efficient polling, then youโll use noticeably more power. But a socket or even long polling is small potatoes especially while the screen is on.
It does for stories and messenger. They constantly heart beat on this connection. Even iOS keeps socket open for notifications. Benefits are no long polls or continuously checking server. Drawback could be little waste of networking on heartbeat.
Other drawback is power burn.
Nah, keeping an open socket with no traffic is well optimized these days. As @JobsAtApp said, the OS does this for push notifications all the time anyway, so the radio is already active just enough for that. If youโre actually receiving things, or doing less efficient polling, then youโll use noticeably more power. But a socket or even long polling is small potatoes especially while the screen is on.