澄清 Firebase 连接 [英] Clarify the Firebase connections

查看:21
本文介绍了澄清 Firebase 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Firebase 定价模型有些困惑,特别关注的是连接或更准确地说是并发连接.

I am a little confused about the Firebase pricing model, special concern is the connections or more precisely concurrent connections.

让我们举一个名为 FanZONE 的 iOS 移动应用示例:

Let's have an example of a mobile app for iOS called FanZONE:

用户将在足球比赛期间创建群组.他们会对实际游戏进行评论,评论会立即显示在每个成员的屏幕上.

这种情况是否意味着参与评论/查看的每个用户都计为一个连接?
因此,如果一个群组包含 100 个积极关注屏幕并不时发表评论的用户,那么每 90 分钟是否有 100 个连接?
那些在后台运行应用程序并且应用程序每 5 分钟检查一次分数的用户呢?这种连接也是 90 分钟长还是每 5 分钟只有一小部分时间?

Does this scenario means that each user who is participating on commenting/viewing counts for one connection?
So if a group contains 100 users who actively follow the screen and from time to time comment is there 100 connections each 90 minutes long?
What about users who have the app in the background and the app checks each 5 minutes the score. Is this connection as well 90 minutes long or only a fraction of time every 5 minutes?

推荐答案

在您的第一个场景中 - 简短的回答是肯定的.只要您的用户将屏幕保持在您拥有允许他们评论/阅读评论的 Firebase 连接的位置,您就会在每个屏幕上拥有一个并发连接.

In your first scenario - the short answer is yes. As long as your users keep the screen on where you have a Firebase connection that allows them to comment/read comments - you will have one concurrent connection per screen.

在您的第二个场景中 - 这取决于您开发应用的方式.Firebase API 确实为您提供了 goOfflinegoOnline 方法 (https://www.firebase.com/docs/ios-api/Classes/Firebase.html#class_methods),让您可以控制您的连接.如果你想离线5分钟,然后短暂地回到在线查看分数然后再次离线,那么你只能保持短暂的连接.

In your second scenario - this depends on how you develop your app. The Firebase API does provide you with the goOffline and goOnline methods (https://www.firebase.com/docs/ios-api/Classes/Firebase.html#class_methods) which give you control over your connection. If you want to go offline for 5 minutes, then briefly come back online to check scores and then go offline again, then you'd only hold a connection for a short duration.

并发连接就是-同时建立的连接.因此,如果您有 3 个人使用您的应用查看分数,但是用户 1 的应用在下午 12:00 上线并且连接持续了 5 秒,那么用户 2 的应用在下午 12:01 上线了 5 秒,而用户 3 的应用应用程序在下午 12:02 上线 5 秒,那么您只有 1 个并发连接.

Concurrent connections are just that - connections established at the same time. So if you have 3 people using your app to check scores, but user 1's app goes online at 12:00 PM and the connection lasts for 5 seconds, then user 2's app goes online at 12:01 PM for 5 seconds, and user 3's app goes online at 12:02 PM for 5 seconds then you've only ever had 1 concurrent connection.

另一方面,如果所有 3 个用户的应用都在下午 12:00 上线 5 秒,那么您将有 3 个并发连接.

If on the other hand, all 3 users' apps go online at 12:00 PM for 5 seconds then you'll have 3 concurrent connections.

您可以在第一个场景中使用相同的 goOffline/goOnline 策略,但如果您的用户希望近乎实时地讨论游戏,这可能会影响体验.

You could potentially use this same goOffline/goOnline strategy with your first scenario, but that may detract from the experience if your users are expecting to be chatting about a game in near real-time.

这篇关于澄清 Firebase 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆