Question:
Despite attempting to implement WebSockets in a Golang application running on a Managed VM, a persistent error message appears in the Chrome developer console:
WebSocket connection to 'ws://127.0.0.1:8080/connect' failed: Error during WebSocket handshake: Unexpected response code: 400
Additionally, the console on the backend displays the following message:
websocket: connection header != upgrade.
Is WebSocket support available for Golang applications hosted on Managed VMs? If so, please provide an example code snippet demonstrating its implementation.
Answer:
According to Google's documentation and the accompanying example, Managed VMs currently only support WebSockets for Java applications. This feature may be incorporated into Go in future releases, as Managed VMs are still in beta.
The above is the detailed content of Does Golang Support WebSockets on Managed VMs?. For more information, please follow other related articles on the PHP Chinese website!