Angular + Firebase三路绑定同步和网络带宽

时间:2014-02-14 05:38:28

标签: javascript angularjs firebase bandwidth

我想通过Angular + Firebase将文本框内容同步到不同的客户端。 我怀疑每当我输入每个字母时,firebase都会与数据库同步吗?

会影响网络带宽吗?基本上它是如何工作的?

1 个答案:

答案 0 :(得分:1)

如果您使用AngularFire的3向数据绑定(即$ firebase(ref)。$ bind方法),那么您键入的每个字母都将与Firebase同步。带宽要求将随每次击键而缩放。

如果需要考虑带宽,并且您不希望每次击键同步,还有其他几种选择:

  • 使用与AngularFire的显式绑定,当您调用某些方法(例如$ set()或$ save()

  • 时,只会同步到Firebase
  • 使用像Firepad这样的OT库来实现精细的协作文本编辑:http://www.firepad.io