可调用云功能是否比HTTP功能更好? [英] Are Callable Cloud Functions better than HTTP functions?

查看:45
本文介绍了可调用云功能是否比HTTP功能更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引入了最新的 Firebase更新可调用函数.我的问题是这种新方式是否比,如果它更安全.

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.

我在这一领域没有专门知识,但是我认为HTTP与HTTPS可能会有所不同.

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.

推荐答案

可调用函数与HTTP函数完全相同,不同之处在于所提供的SDK可以为您完成一些不必要的工作.在客户端上包括:

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

  1. 通过请求处理CORS(对于Web客户端)
  2. 发送经过身份验证的用户令牌
  3. 发送设备实例ID
  4. 序列化在客户端传递的输入对象
  5. 反序列化客户端中的响应对象

在函数的后端:

  1. 验证用户令牌并从中提供用户对象
  2. 反序列化函数中的输入对象
  3. 序列化功能中的响应对象

所有内容均在文档中说明.如果您可以自己完成所有这些工作,那么不要使用可调用对象.如果您希望这项工作自动完成,那么可调用项会有所帮助.

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

如果您需要直接控制HTTP协议的详细信息(方法,标头,内容主体),则不要使用可调用对象,因为它会隐藏所有这些详细信息.

If you need direct control over the details of the HTTP protocol (method, headers, content body), then don't use a callable, because it will hide all these details.

使用可调用对象没有安全优势.没有速度改进.

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

这篇关于可调用云功能是否比HTTP功能更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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