Hook for poll synchronization via the semantic relay.
Configuration options
Sync functions and connection state
This hook handles real-time synchronization of poll state across all participants in a room.
Message Flow:
Owner Responsibilities:
function PollsWithSync() { const pollsRef = useRef(new Map()); const userVotesRef = useRef(new Map()); const { createPoll, startPoll, endPoll, castVote, connected, } = usePollSync({ isOwner, localUserId: userId, localUserName: userName, pollsRef, userVotesRef, onStateUpdate: setPolls, });} Copy
function PollsWithSync() { const pollsRef = useRef(new Map()); const userVotesRef = useRef(new Map()); const { createPoll, startPoll, endPoll, castVote, connected, } = usePollSync({ isOwner, localUserId: userId, localUserName: userName, pollsRef, userVotesRef, onStateUpdate: setPolls, });}
Hook for poll synchronization via the semantic relay.