What is the failure of socket.io-client to link to java's websocket?

problem description

java uses native code to write websocket,. I link through socket.io-client, and the service passes third-party tests, such as http://www.blue-zero.com/WebS.
, but the code just doesn"t link.

the environmental background of the problems and what methods you have tried

if you do not add transports: ["websocket"], , the rotation training method used, do not report failed, but connect_error.
if you add it, you will report that the link has failed, and you will not be able to connect directly.

websocket.js:112 WebSocket connection to "ws://192.23.1.16:8080/api/webSocket/?EIO=3&transport=websocket" failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
webpackJsonp.2131.WS.doOpen @ websocket.js:112
OrderList.js:80 ******************connect_error ************ Error: websocket error
    at WS.webpackJsonp.2113.Transport.onError (transport.js:64)
    at WebSocket.ws.onerror (websocket.js:150)

related codes

const socket = io("ws://172.23.1.16:8080", {
      path: "/seller/webSocket",
      transports: ["websocket"],
    })
    // socket.open()
    socket.on("connect", () => {
      console.log("*********************connected")
    })
    socket.on("connect_error", err => {
      console.log("******************connect_error ************", err)
    })

what"s going on? Can socket.io-client only link to services written by socket.io?

Aug.11,2021

socket.io-client can only be connected to the socket.io server. Socket.io has its own communication format. By default, socket.io uses http to complete the socket.io handshake, and then changes to the websocket protocol to communicate according to the socket.io communication format. If your websocket server cannot understand the data format sent by socket.io-client, it cannot communicate with it.

Menu