Dhaval
Dhaval

Reputation: 1

I think there is the rerender in the component so that's why the socket is not working

I check all sockets of the server by Postman. Here I think the problem is rerender and because of rerender

  useEffect(() => {
    socket.on('user-joined', handelNewUserJoined)
    socket.on('incoming-call', handelIncomingCall)
    socket.on('answer-from-user', handelAnswerFromUser)
    console.log("use effect from user join")
    return () => {
      socket.off('user-joined', handelNewUserJoined)
      socket.off('incoming-call', handelIncomingCall)
      socket.off('answer-from-user', handelAnswerFromUser)
    }
  }, [handelNewUserJoined, handelIncomingCall, handelAnswerFromUser, socket])

Is de-register and register between that events that is emit by server is not listen by frontend listener? Any suggestion, please.

Upvotes: 0

Views: 15

Answers (0)

Related Questions