Skip to content

Instantly share code, notes, and snippets.

@qgustavor
Last active June 7, 2016 11:23
Show Gist options
  • Select an option

  • Save qgustavor/7f79320b10032952744ab5f0502802b2 to your computer and use it in GitHub Desktop.

Select an option

Save qgustavor/7f79320b10032952744ab5f0502802b2 to your computer and use it in GitHub Desktop.

The Tab Locking Problem

A certain web application is suffering problems caused by high server usage. In order to solve this I tried to implement tab locking, in other words, making that just one opened tab will send request to the server, while the others will just sincronize with this tab.

I tested three libraries:

  1. https://github.com/slimjack/IWC
  2. https://github.com/tejacques/crosstab
  3. https://github.com/nodeca/tabex

Those are the problems:

  1. A tab got elected and connected to the servers. The others don't connected to the servers but also don't received any message from the master tab.
  2. It elected a master tab, but when it's closed no other tab is assigned to be the master tab, breaking the page.
  3. It works well, but just for two tabs. When a third tab is opened it gets the lock and also connects to the server.

Tested on Firefox 48.0a2.

@qgustavor
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment