在 GAE 上运行 Websocket [英] Run Websocket on GAE

查看:21
本文介绍了在 GAE 上运行 Websocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 websocket 调整我的应用程序以在 GAE 上运行,但是阅读文档,我没有找到解决这个问题的好方法.

I'm trying adapt my app using websocket to run on GAE, but reading the Docs, I'm not find a pretty solution to this problem.

使用一个非常简单的应用程序:https://github.com/marcosbergamo/gae-nodejs-websocket

Using a really simple application like that: https://github.com/marcosbergamo/gae-nodejs-websocket

这是我尝试使用的示例演示.但是当我尝试连接到我的 websocket 时收到此错误;

This is my sample demo trying use. But I'm receive this error when I try to connect to my websocket;

关注请求的图片;

推荐答案

经过大量时间的学习和测试,谷歌的朋友给我介绍了一个解决这个问题的方法!感谢蒂亚戈·阿瓦西尼!

Later a lot of hours study and tests, a friend in Google show me one solution for this problem! Thanks Thiago Avancini!

嗯,解决办法是:

第一步是使用托管虚拟机.(回购使用它.)但目标是将管理从 Google 切换到用户.执行此操作后,下一步是为您的应用程序创建静态 IP.在我的情况下,我使用端口 3000 来为我的 Websocket 提供服务,请随意更改.在我的 app.yaml 上,我也像这样启用了这个端口:

The first step is using the managed-vms. (The repo use it.) But the goal is switch the managing from Google to User. When you do this, the next step is create an static IP for your application. On my case I using the port 3000 to serving my Websocket, feel free to change. On my app.yaml I enable this port too like this:

network:
  forwarded_ports: ["3000"]

记得在网络>>默认>>防火墙"中的代理上启用这个端口.

Remember to enable this port on the proxy in "network>>default>>firewall".

如果您通过 gcloud 部署应用程序,则需要在应用程序上再次启用用户管理和静态 IP.

If you deploy the application via gcloud, you need enable again on your application the user management and the static IP.

我会将这个存储库发送到 GoogleCloudPlatform,因为它将是在 AppEngine 上使用 websockets 的示例.

I'll send to GoogleCloudPlatform this repo for will be a sample for using websockets on AppEngine.

这篇关于在 GAE 上运行 Websocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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