Websocket can be written natively, but will an error be reported with socket.io-client?

proxy configured, local port is 9527

proxy: {
  "/socketServer": {
    target: "ws://192.168.30.76:8087",
    changeOrigin: true,
    ws: true,
  },
},
let ws = new WebSocket("ws://localhost:9527/socketServer/server-admin")
ws.onopen = function(data) {
  console.log("WebSocket: ")
}    

Native writing this is a successful
clipboard.png

Socket.io-client~


clipboard.png

I don"t know what"s wrong.

Mar.18,2022

does the backend also need to use socket.io 's library?


socket.io is a little different from WebSocket. If you want to use socket.io backend, you also need socket.io

.
Menu