3

I've tried using websockets within my Golang application served from Google's managed vm but I couldn't get it to work, from Chrome developer console I'm getting:

WebSocket connection to 'ws://127.0.0.1:8080/connect' failed: Error during WebSocket handshake: Unexpected response code: 400" and on my backend I'm getting: "websocket: connection header != upgrade.

My question, does managed vm supports Golang websockets? If so a code snip would be appreciated.

tomrozb
  • 25,773
  • 31
  • 101
  • 122
SWilly22
  • 869
  • 4
  • 5
  • You may see that error if you are trying to access the server from the APP_ID.appspot.com url. You should access the instance directly by public ip (or CNAME). If running locally, since you mentioned 127.0.0.1, then use the docker container ip. – Jeff Deskins Jan 07 '15 at 21:12
  • Still no luck, I've deployed my app to "production", updated my websocket url to point to my appspot url (i'm running only one instance for the time being) and i'm still receiving: "WebSocket connection to 'ws://APPID.appspot.com/connect' failed: Error during WebSocket handshake: Unexpected response code: 400" – SWilly22 Jan 08 '15 at 10:35
  • 1
    You cannot use the appspot.com url for websockets. You need to use the ip address of the managed-vm to hit the server directly. Using the appspot.com url, you are hitting other Google frontend servers before you get to the app. – Jeff Deskins Jan 08 '15 at 19:22

1 Answers1

0

As per Google's documentation and the example included over there, Managed VMs supports WebSocket in "Java" language as for now. May be in the future release (as Managed VMs is still in its Beta version), "GO" language will be put into consideration for addressing such functionality and/or feature.

Mohab
  • 153
  • 6