无法连接到 Google Cloud App Engine 上的 socket.io
Cannot connect to socket.io on Google Cloud App Engine
目前我正在使用 ionic 2 开发移动应用程序。在该应用程序中我获得了聊天功能。聊天功能基于 NodeJS API 中的 Socket io。不幸的是,很难在 Google Cloud App Engine 上配置套接字 io。在我的本地机器上它工作正常。
我进行的步骤:
- 使用端口 65080(并打开防火墙端口)
- 2 个服务器(api 通过 8080 调用和通过 65080 进行套接字 io
Sample
有人有解决办法吗?提前致谢!
耶勒
遗憾的是,socket.io 或 Websockets 目前都不能在 App Engine 上运行。这是我们正在积极尝试解决的问题:
https://cloud.google.com/appengine/docs/flexible/nodejs/how-requests-are-handled#not_supported
这个问题和this one几乎一模一样,还有一些新的好消息:
GAE support for persistent socket connections arrived in February 2019!
To make this work, you'll need to be using the flex
environment and modify your app.yaml
to include session_affinity
.
目前我正在使用 ionic 2 开发移动应用程序。在该应用程序中我获得了聊天功能。聊天功能基于 NodeJS API 中的 Socket io。不幸的是,很难在 Google Cloud App Engine 上配置套接字 io。在我的本地机器上它工作正常。
我进行的步骤:
- 使用端口 65080(并打开防火墙端口)
- 2 个服务器(api 通过 8080 调用和通过 65080 进行套接字 io
Sample
有人有解决办法吗?提前致谢!
耶勒
遗憾的是,socket.io 或 Websockets 目前都不能在 App Engine 上运行。这是我们正在积极尝试解决的问题:
https://cloud.google.com/appengine/docs/flexible/nodejs/how-requests-are-handled#not_supported
这个问题和this one几乎一模一样,还有一些新的好消息:
GAE support for persistent socket connections arrived in February 2019!
To make this work, you'll need to be using the
flex
environment and modify yourapp.yaml
to includesession_affinity
.