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;
In order to use websockets, you must use the Google Managed VM with custom runtime.
https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes
Once that is running, you will need to access that server directly by ip or cname. You cannot go through the appspot.com domain.
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.
Update: February 4, 2019
WebSockets is available to your App Engine Flexible Environment application with no special setup. Take a look at our documentation to learn more: Python | Java | Nodejs.
You must add to your app.yaml
network:
session_affinity: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With