带有 socket.io 的 Google Cloud Functions [英] Google Cloud Functions with socket.io

查看:35
本文介绍了带有 socket.io 的 Google Cloud Functions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的理解是,要使用 socket.io 建立持久的套接字连接,Node.js 服务器应该始终运行.使用 Google Cloud Functions 时,Node.js 服务器并不总是在运行,因此无法保持套接字连接处于活动状态.

My understanding is that to establish a persistent socket connection using socket.io the Node.js server should be always running. With Google Cloud Functions there isn't an always running Node.js server, so keeping a socket connection alive is not possible.

带有正在运行的 Node.js 服务器的 Cloud Run 是使用 socket.io 处理多个套接字连接的最佳选择吗?

Is Cloud Run with a running Node.js server the best option to handle multiple socket connections using socket.io ?

推荐答案

UPDATE:从 2021 年 1 月开始,GCP Cloud Run 支持 WebSockets.

UPDATE: From January 2021, GCP Cloud Run supports WebSockets.

这是 Cloud Run 文档的链接

这是博客文章的链接(他们的公告)

这篇关于带有 socket.io 的 Google Cloud Functions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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