i am working on realtime chat-app … want to integrate websocket for instance chat … but i am getting the error i am getting this kind of error (socket__io-client.js?v=6fe409f1:1018 WebSocket connection to 'ws://localhost:5000/socket.io/?EIO=4&transport=websocket' failed: ) ...
=======> my source code on react <========
`
if (userInfo) {
const socket = io("http://localhost:5000", {
transports: ["websocket"],
});
socket.on("connect", () => {
console.log("Connected:", socket.id);
});
setSocket(socket);
return () => {
socket.close();
};
}
i read the webSocket Doc but didn’t findout the solution and they also did on the same way … may the error is about the connection ..
2