The console repeatedly outputs WebSocket connection to 'ws://10.133.212.203:8080/ws' failed:

The console repeatedly outputs WebSocketClient.js?5586:16 WebSocket connection to 'ws://10.22.219.126:8080/ws' failed:

Open the vue project today, the project runs fine, but it keeps outputting this error repeatedly, which is very uncomfortable, as follows:
insert image description here

Found a workaround that works:

Configure the following code in vue.config.js:

  devServer: {
    
    
    host: '0.0.0.0',
    port: 3000,
    client: {
    
    
      webSocketURL: 'ws://0.0.0.0:3000/ws',
    },
    headers: {
    
    
      'Access-Control-Allow-Origin': '*',
    }
  }

Guess you like

Origin blog.csdn.net/weixin_46466212/article/details/126762870