iOS web apps only look for UI updates every 2 seconds?

Working on a mobile/iOS web app that returns feedback from your actions, but it seems that the iOS browser doesn’t respond very well to pushed changes. It feels very different than a regular browser. I don’t believe this is just due to the different capabilities of the iOS browser or less system and network speed. It feels like the iOS browser is actually polling for changes every 2 seconds. Thats the fastest I can update anything. Even just sending a simple label text change can’t show up at the iOS browser in less than 2 seconds.

If the UI changes are generated in the action event of the button you clicked then the iOS browser updates immediately as those changes are sent back in the same connection/conversation. However, if they come back slightly delayed say s the result of an async query or something then it takes 2 seconds no matter what. I can duplicate it by just delaying 100ms or so from the initial button click, restoring the web session and sending back a result. Even though the server app THINKS it’s sent the data, the browser doesn’t even try to load the changes for 2 seconds.

If I happen to generate a user action that talks to the server while that change is outstanding it’s sent back immediately along with any other new data. for example if I click any other button then the outstanding changes are returned along with that hit. But if I’m just waiting for an update it takes 2 seconds before they show up.

I thought we were working with WebSockets now? Aren’t they totally open all the time? Is there a throttle on the AJAX refresh for iOS apps that isn’t there for regular browser connections?

On iOS, we had to switch to ServerEvents a while back because of a bug in the os itself, so the mechanism for pushing is different.

I hope you’ve made a bug report because it’s not an equivalent solution… I’ve just today been experimenting with adding a short time span webTimer to my pages. When something is expecting a response it fires a few times for a few seconds and generates a lot of stupid useless traffic but it does dramatically speed up the reception of anything pushed.

The whole point of ServerEvents is to reduce the amount of power that is used when the device is in different modes of operation:

  1. Plugged in vs. not
  2. Wifi vs. cellular

Sorry for my tone :wink: Didn’t mean to be snippy, it’s just such a lovely app and framework and I wanted it to be snappier :wink: I did some quick testing and there is a small difference between wifi vs cellular, but it doesn’t seem to be faster connections, only the reduced latency you’d expect. I also can’t tell any difference between plugged in or on battery. Something does make a difference though, every so often for no reason I can figure out it’s perfect and just as fast as running on the desktop. But that stops and it goes back to making you wait 2 seconds for the next update.

You might see if it has to do with how many other apps are open, even if they’re sleeping.

It’s also worth noting that network conditions are a much bigger factor. Wifi or cellular interference would cause similar slowdowns.

I will continue to experiment. It doesn’t initially FEEL like the latency of the connection is the problem. I can see in my log on the server that the change has been sent, and then up to 2 seconds later the network activity spinner lights up on the iPhone and as soon as that happens the changes show up almost instantly. It feels like it’s polling. Also if I perform some other action on the phone side that causes another bit of data to be sent, the changes will also appear immediately in the response to that. They just dont push from the server without delay.