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

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

问题描述

我尝试使用websocket在GAE上运行我的应用程序,但是阅读Docs,我找不到解决此问题的好方法。



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



这是我尝试使用的示例演示。但是,当我尝试连接到我的websocket时,我收到了这个错误;

请关注请求的图片;



解决方案

后来经过很多小时的学习和测试,Google上的一位朋友向我展示了这个问题的一个解决方案!
感谢Thiago Avancini!



好的,解决方案是:

第一步是使用托管的虚拟机。 (回购使用它。)
但目标是将管理从Google切换到用户。当你这样做时,下一步就是为你的应用程序创建一个静态IP。在我的情况下,我使用端口3000来服务我的WebSocket,随时可以改变。
在我的app.yaml上,我也是这样启用这个端口:

  network:
forwarded_ports:[ 3000]

请记住在网络>>默认防火墙中启用代理端口。



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



我会发送到GoogleCloudPlatform,这个回购将是一个在AppEngine上使用websockets的示例。


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.

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

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

Follow the image about the request;

解决方案

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

Well, the solution is:

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".

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

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

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

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