3

I’m about to deploy a firebase project using firebase database, storage, authentication, and cloud functions; and I intended to implement TLS session resumption as recommended in the firebase docs in order to lower costs and loading times.

I’ve been scavenging around the web for information on how to do this, but the best I’ve gotten is:

var tlsSessionStore = {};
server.on("newSession", function (id, data, cb) {
    tlsSessionStore[id.toString("hex")] = data;
    cb();
});
server.on("resumeSession", function (id, cb) {
    var tlsSessionId = id.toString("hex");
    cb(null, (tlsSessionId in tlsSessionStore) ? tlsSessionStore[tlsSessionId] : null);
});

Extracted from:

https://github.com/nodejs/node/issues/3132

Without a real description of what I would need to import to the project to make this work, or any explanation of what to do.

To be completely honest I’m a bit lost in the matter, as I wouldn’t even know how to apply this (using firebase cloud functions?), if this would apply to the connection to the database and storage, and finally, how I could test that everything is working once everything is done.

Are there any resources that could guide me through this process?

Oranakia
  • 129
  • 1
  • 10
  • Surprising that it doesn't support it out of the box. Everything else does. You shouldn't really be required to add any code for this. – user207421 Jul 21 '18 at 01:08
  • @EJP The firebase documentation states that TLS session resumption should be used as a recommendation to lower costs, so it probably isn’t included. Also, there is this article floating around: https://startupsventurecapital.com/firebase-costs-increased-by-7-000-81dc0a27271d where the writer states that “the excessive usage was due to requests not using something called TLS Tickets (something I have never seen mentioned in any library or package)”. – Oranakia Jul 21 '18 at 03:59

0 Answers0