Socket id generating . #4820
Unanswered
AthulKkumar
asked this question in
Q&A
Replies: 1 comment
-
Hi! Did you check our React guide here? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Socket.IO is creating 2 or more socket IDS every time a new user joins a room.
This is from socket.js
`export const initSocket = async () => {
const options = {
"force new connection": true,
reconnectionAttempts: "Infinity",
timeout: 10000,
transports: ["websocket"],
};
return io(process.env.REACT_APP_BACKEND_URL, options);
};`
This the component code :
`
import { initSocket } from "../socket";
....
const socketRef = useRef()
useEffect(( ) =>{
const init = async () => {
socketRef.current = await initSocket();
}
init()
}, [])
`
Beta Was this translation helpful? Give feedback.
All reactions