On Thursday, February 28, 2013 6:34:08 PM UTC-5, Avital Oliver wrote:
This looks great! I believe there's also a problem with battery usage, because of long-polling (this is a problem for all real-time mobile web apps). My understanding is that websockets don't work on mobile in some cases such as 3g, so that's not a good solution either. Maybe for mobile we need to make polling much less frequent, and especially poll on certain user actions.
Do you know of any studies or data that shows that long polling is worse than web sockets? I mean, I don't know, but at a guess I would think that a web socket is going to be exchanging a few packets now and again if just for keep alive, and a long poll will exchange some packets every thirty seconds or so (whatever the long poll interval is)... which doesn't sound too dramatic a difference.
I'd also be curious to know if there's a difference in battery usage between WiFi vs. 3G, and what the actual impact is... would, for example, changing the long poll interval make a noticeable difference?
If it actually does, we could see if we can detect inactive tabs, or look for UI events, and lengthen the interval when the user isn't interacting with the app.
On my iPad it is annoying because the long poll does make the Internet spinner spin continuously... but as far as I know there's nothing that can be done about that (a web socket connection doesn't activate the spinner, but like you say we can't use it if we have no way to avoid the Safari crash on a 3G connection).