Home >Backend Development >Golang >Does Golang Support WebSockets on Managed VMs?

Does Golang Support WebSockets on Managed VMs?

Barbara Streisand
Barbara StreisandOriginal
2024-11-22 01:30:13188browse

Does Golang Support WebSockets on Managed VMs?

Golang WebSocket Support in Managed VM

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn