新的Firebase云功能https.onCall触发器更好吗? [英] Is the new Firebase Cloud Functions https.onCall trigger better?

查看:116
本文介绍了新的Firebase云功能https.onCall触发器更好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用最新的 Firebase更新可调用功能。我的问题是这种新方式是否比旧http触发器以及它是否更安全。



<我没有这方面的专业知识,但我认为HTTP与HTTPS可能有所不同。



这对我很有意思,因为如果可调用函数更快,他们有这个优势,但他们的缺点在于灵活性:他们无法通过其他来源达到。



如果可调用函数在速度或安全性方面没有优势我没有理由将其切换。

解决方案

可调用函数与HTTP函数完全相同,除了提供的SDK为您做一些额外的工作,您不必这样做。这包括:


  1. 发送经过身份验证的用户的令牌

  2. 发送设备实例ID

  3. 序列化在客户端传递的输入对象

  4. 在函数中反序列化输入对象

  5. 序列化响应对象在函数中

  6. 反序列化客户端中的响应对象

这一切都在文档。如果你想自己做这项工作,那就不要使用callables。如果你想自动完成这项工作,那么可以使用callables。



使用callables没有安全优势。没有速度提升。


With the latest Firebase Update callable functions were introduced. My question is whether this new way is faster than the "old" http triggers and if it is more secure.

I have no expertise in this field, but I think the HTTP vs HTTPS might make a difference.

This is interesting to me because if the callable functions are faster, they have that advantage, but their disadvantage lies in the nature of flexibility: They cannot be reached by other sources.

If the callable functions have no advantages in terms of speed or security I do not see a reason to switch it up.

解决方案

Callable functions are exactly the same as HTTP functions, except the provided SDKs ares doing some extra work for you that you don't have to do. This includes:

  1. Sending the authenticated user's token
  2. Sending the device instance id
  3. Serializaing an input object that you pass on the client
  4. Deserializing the input object in the function
  5. Serializing the response object in the function
  6. Deserializing the response object in the client

This is all stated in the documentation. If you want to do this work yourself, then don't use callables. If you want this work done automatically, then callables are helpful.

There are no security advantages to using callables. There are no speed improvements.

这篇关于新的Firebase云功能https.onCall触发器更好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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