首页 > 解决方案 > Firebase database - react native - TLS session resumption

问题描述

I'm building a social chat app with react native, and have been struggling with choosing between firebase and hosting an AWS EC2 server.

I love using firebase and would prefer to use it for my app, however I'm worried about the pricing of the bandwidth. As the app is a chat application, there will be lots of opening and shutting down of the app, and small messages sent. It appears that the main problem with this would be the TLS session handshake required to interact with the db.

I've read the docs, and seen that certain devices don't use TLS session resumption which can incur large costs. I've honeslty not heard of this before and wonder whether theres anything I can do to combat the problem.

Is it possible to persist the connection to firebase servers so I don't have to keep initiating an SSL handshake?

标签: firebasefirebase-realtime-database

解决方案


You don't have any control over the connection that the Firebase SDK maintains to the server. In fact, the Firebase SDK itself doesn't have any control over the connection with regards to how the host OS manages the lifecycle of the browser or app. If the host OS decides that the process should stop networking because it's no longer in the foreground (in order to save the user the cost of data transfer), then it will simply shut down its ability to network. Also, the host OS may decide that the app's process is no longer needed because the user isn't looking at it any more. So it may simply kill off that process.

Essentially, as an app developer, you are forced to work within the constraints imposed by the host OS, and these constraints are set in place for the benefit of the end user to save data and battery.


推荐阅读