1

I used the waitForLeadership to let only one tab sync the db. And it looks like it works. But if I activate this feature and open more than 3 tabs, the next tabs won't load. Chrome always says, waiting for available socket...

Did anyone had/have the same issue?

What did I do wrong? Did I have to manually start the sync process? If I insert in one instance, master or not, it is visible in all correctly. But it seems, that multiple instances try to open a socket/long polling.

newRxDb.waitForLeadership().then(() => {
   console.log(`isLeader now`);
});
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Auryn
  • 1,117
  • 1
  • 13
  • 37

1 Answers1

1

I think there's some issue in your service worker no problem, this issue may have been resolved by the release of rxdb v 9.0.0

But I think the problem may be that you are opening multiple browser consoles for the same url, so you can try to check for leadership directly in your title

Whichever page is leader will be prefixed as Online along with the title name

    // show who's the leader in page's title
    db.waitForLeadership().then(() => {
      document.title = 'Online ' + document.title;
    });

This is just my opinion, hope this helps