语言

Menu
Sites
Language
[wearable] Implications of long lived websockets and battery life?

I am developing an enterprise app for Gear S3 that is used by people for extended amount of time (the entire day). These are LTE watches that work in standalone mode and are not paired to a mobile device. We now have a new requirement to deliver real-time updates to the app. 

Using websockets would be the logical solution for a desktop webapp, but I'm concerned about the implications to battery life of keeping a persistent socket connection to the server. Would such an implementation result in a signifant hit on battery life? 

The alternative solution could be to poll the server at a fixed interval, but this has its downsides as well (more overhead, higher bandwidth). I will have to go this route though, if it would save considerable battery life.

Are there any best practices for watch apps (specifically those that need to rely on LTE for connection) that need realtime updates? 

I know there's Push notifications as well, but imagine that beyond a certain update frequency that option would become unfeasible as well. 

thanks
Peter

 

编辑者为: John Ixion 16 11月, 2017

响应

5 回复
Armaan-Ul- Islam

Hello Peter Hulst, Your topic seemed Interesting to me and I've looked in a few articles to know more about the matter. Investing some time on web, It seems that persistent Websocket connection is really a battery killer when it comes to mobile applications. And here, we are talking about just a Non-removable Li-Ion 380 mAh battery of gear S3.

I would suggest you to go for Push Notification. 'Push Notification' service should help to sort out the power consumption. Though I don't see any documentation about the frequency it supports, But I expect they offer heavy duty solutions.

Now, There's a Tool out there called 'Dynamic Analyzer' to analyze your application for potential performance issues, such as high usage of CPU, memory, file, or network operations to help you optimize the application. You may play with the tool, If you are looking for some power consumption analytics.

Peter Hulst

Thanks for the suggestion on Dynamic Analyzer, I will definitely take a look at that. I came across some interesting research related to the impact of using websockets on mobile devices: 

http://nordsecmob.aalto.fi/en/publications/theses2013/thesis_estep/

While this is a few years old and not specific to the Gear S3 or any smartwatches, it does suggest that websockets should be highly optimized on mobile devices.
As long as heartbeat intervals are not too high (and they don't need to be) a device can keep a websocket open while still allowing the hardware to go in idle mode, yet wake up as soon as data is received. 
Obviously high levels of server-to-watch communications will affect battery life but that would be the case regardless of what method is used. 

I don't know how Push Notifications are implemented at a lower level, but would not be surprised if they are built on top of the same web- (or some other type of open TCP) socket technology. 

After reading the above thesis it appears that the most efficient way to get data to the device in real time might be websockets, due to the much lower communication overhead compared to polling or even Push Notifications. 

I will do some testing with this and will report back. In the meantime if you (or anyone else) has any valuable input or findings from similar research please do share it. 

thanks

Peter

John Ixion

wifi could be an alternative for an enterprise app

 

https://www.technipages.com/does-wi-fi-consume-more-battery-power-than-3g-or-4glte

Armaan-Ul- Islam

Thanks, Olivier Nyssen For the Info. 

 

Though A Developer should not assume 'which network mode (Wi-fi or 3G/4G-LTE) the User would set on his device to use the application'. Nor A developer should insist application users to be rigid with any network mode (Wi-fi or 3G/4G-LTE)

 

But I guess Mr. Peter Hulst may add your suggestion on readme file of the app. At least I would set my mobile on Wi-fi rather than 3G/4G from Now on :)

Peter Hulst

The app I'm working on is for private enterprise use, It's loaded on watches that are provided to workers. Unfortunately, the devices need to work in standalone mode (not paired to a mobile device), they're used outside, so neither Wifi nor Bluetooth is an option for data communication.

On the positive side, as long as we can make sure that the battery lasts through a worker's shift, we're good. 

I'm going to run some comparisons of running the app with and without websocket connections for a day and will post the results.