jitsi-roomsv2/frontend/src/hooks/useBackendData.ts

21 lines
387 B
TypeScript
Raw Normal View History

import useWebSocketConnection from "./useWebSocketConnection";
function useBackendData() {
const { onMessage, sendMessage } = useWebSocketConnection();
const { roomData, setRoomData } = useRoomData()
onMessage(
(messageString) => {
const messageObject = JSON.parse(messageString)
!!messageObject.roomData && setRoomData(messageObject.roomData)
}
)
}