socketio / socket.io-client

Realtime application framework (client)
https://socket.io
10.63k stars 3.04k forks source link

WebSocket Failing to Connect in Debug Mode - "Allowing connection to any root cert" Error #1626

Open echonikul opened 1 month ago

echonikul commented 1 month ago

export var abhaSocket;

const initializeAbhaSocket = () => { return new Promise(async (resolve, reject) => { try { // Using different URLs for staging and production modes let url = isRelease ? "wss://dummy-production-url.com" : "wss://dummy-staging-url.com"; abhaSocket = null;

  // WebSocket configuration
  const webSocket = io(url, {
    transports: ["websocket"],
    extraHeaders: {
      Authorization: `Bearer dummyAccessToken`,
      "x-auth-token": `Bearer dummyXToken`,
      "r-token": `Bearer dummyRefreshToken`,
    },
    autoConnect: true,
    reconnection: true,
  });

  // Assign the socket instance
  abhaSocket = webSocket;

  // Resolve the promise with the WebSocket
  resolve(webSocket);
} catch (err) {
  console.log("error on abhaSocket connection");
  reject(err);
}

}); };

// Exporting the abhaSocket for use in other parts of the application export { initializeAbhaSocket };

// Note: This WebSocket connection works fine in release mode, but in debug mode, // it fails to connect and logs errors related to certificates.

darrachequesne commented 4 days ago

Hi! This sounds like an issue with your certificates. Were you able to find the culprit?