awwx / meteor-offline-data

Meteor offline data project.
MIT License
111 stars 9 forks source link

Second iOS tab fails to update server (agent window hand off) #17

Closed awwx closed 11 years ago

awwx commented 11 years ago

When a tab became inactive, the original simulation code had the current active tab become the agent window. This is because on iOS Safari, tabs while inactive don't fire setTimeout and setInterval events, which prevents livedata from communicating with the server.

The hand off algorithm mechanism proved to be too heavyweight to use on real devices, as database transactions were taking longer to run than the polling interval.

Currently there is no mechanism for the active tab to take over being the agent window. (The agent window only switches if the current agent window is closed).

The symptom is that you open two (or more) tabs in iOS Safari, the first tab becomes the agent window, but when you switch to the second tab it doesn't have communication with the server (because the first tab is still the agent window, but it isn't communicating with the server while inactive).