Firebase concurrent connections chrome extension

I just hit a situation which pushed me to ask this question:

I have about 150 active monthly users and I just hit 1k concurrent connections on a single day.

I did research and found many questions on “firebase concurrent connections” topic and those who refers to user-to-concurrent ratio say that on average it’s close to 1 concurrent = ~1400 monthly users (like here and here).

I’m now trying to understand if I really did something wrong and if yes, how to fix that?

The questions are:

  • Is it look ok to get 1k concurrent connections with about 150 active users? Or am I reading it wrong?
  • Is it possible to profile concurrent connections somehow?
  • What are the typical “connection leaks” when it comes to chrome extensions and how to avoid them?

enter image description here

So far the architecture of the extension is that all the communication with firebase database is made from the background persistent script which is global to a browser instance.

And as a note, 150 active users is an estimation. For upper boundary I can say that I have 472 user records in total and half of them installed the extension and uninstalled it shortly after that – so they are not using it. And about 20% of the installed instances are also disabled in chrome.

How to use firebase database in chrome extension

I want to use it as part of my content script so that I can fetch data from my firebase database. However, I don’t know how I can reference the script that’s given in the firebase docs:


I know that if I was doing it all in the pop up html page, then I could load the script tag, but in the content script, there’s no html page other than the content page, so I’m not sure if this is even possible.

Cloud Firestore not returning data when used inside chrome extension

I’m trying to use firestore inside a chrome extension and I set everything up following some docs I found through google.

In my manifest.json file I added this:

"content_security_policy": "script-src 'self' https://www.gstatic.com https://*.firebaseio.com; object-src 'self'"

And inside a html file where I want to use firestore, I’m including these:




In that same html file, I’m including another js file which has the following code:

var config = {
    apiKey: "xxx",
    authDomain: "xxx",
    databaseURL: "xxx",
    projectId: "xxx",
    storageBucket: "xxx",
    messagingSenderId: "xxx"
  };

firebase.initializeApp(config);

firebase.firestore().collection('users').onSnapshot(function(snapshot) {
    console.log(snapshot.docs);
});

The problem is that snapshot.docs is always an empty array despite some data actually existing. There are no errors or warnings. It just returns an empty array.