TL;DR: Need to use WebSockets on AE. Only works on MVM. NewContext fails, BackgroundContext works. Logs are polluted & disorganized (/_ah/background)
Hey,
I would like to communicate with my App Engine app over WebSockets.
I have found that the Java library has an official (github) example of using WebSockets under the Managed VMs framework,
after browsing the implementation I noticed that it queries the internally exposed metadata service to get the external IP of the machine and redirects the client to it.
However I expect my application to receive more traffic than a single server would handle and so I need a load-balanced solution (cannot relay on a single static-IP)
so I've looked into App Engine's "Network Load Balancer" and after an hour (and a long deploy time) I was up and running with now my domain set to the load balancer's static IP.
Now is a good time to note that I use the Go standard runtime.
While porting my app from the Classic App Engine I was facing an issue with the request context (which now "skips" the default HTTP load balancer and goes straight to my MVM(gce) node).
I was getting an error ("appengine: NewContext passed an unknown http.Request").
To overcome my need for datastore/logging/other App Engine facilities I used context.BackgroundContext() everywhere and it seemed to work well for the datastore/urlfetch/etc..
Everything worked but the logging facility which was polluting my logs with empty "/_ah/background" lines and everything else was multiplexed into a single huge "/_ah/background" entry.
This makes it very difficult to debug or monitor my application.
My questions are:
1) Can I use the classic App Engine/default http load balancer/custom http load balancer to service my WebSocket requests?
2) Can I, with my current solution, get the X-AppEngine-* headers?
3) How could I, with my current solution, split the log lines to per request entries (very like the classic app engine logs)
4) Is this the right approach?
Thanks.