Working on a mobile/iOS web app that returns feedback from your actions, but it seems that the iOS browser doesnt respond very well to pushed changes. It feels very different than a regular browser. I dont 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 cant 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 its sent the data, the browser doesnt 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 its 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 Im just waiting for an update it takes 2 seconds before they show up.
I thought we were working with WebSockets now? Arent they totally open all the time? Is there a throttle on the AJAX refresh for iOS apps that isnt 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 youve made a bug report because its not an equivalent solution… Ive 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:
- Plugged in vs. not
- Wifi vs. cellular
Sorry for my tone Didnt mean to be snippy, its just such a lovely app and framework and I wanted it to be snappier I did some quick testing and there is a small difference between wifi vs cellular, but it doesnt seem to be faster connections, only the reduced latency youd expect. I also cant 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 its 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 doesnt 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 its 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.