Skip to main content
Version: 0.1.x

Send Messages - React

Whenever any participant wants to notify other participants via chat messages or Raise hand, they can simply do it with VideoSDK Meeting.

This guide will provide an overview of how to implement chat and raise hand in a meeting.

  1. Chat Message - If a participant wants to inform or notify something in current meeting, they can use publish() function of the usePubSub hook and using the topic CHAT.

  2. Raised Hand - If a participant has some doubts during the meeting and wants to raise hand, they can use publish() function of the usePubSub hook and using the topic RAISED_HAND.

note

publish() function only takes string as an argument.

Send Message

// importing usePubSub hook from react-sdk
import { usePubSub } from "@videosdk.live/react-sdk";

const MeetingView = () => {
// destructure publish method from usePubSub hook
const { publish, messages } = usePubSub("CHAT");

const onPress = () => {
// Sending Message
const message = "Hello Everyone!";
publish(message, { persist: true });
};

return <>...</>;
};

Raise Hand

// importing usePubSub hook from react-sdk
import { usePubSub } from "@videosdk.live/react-sdk";

const MeetingView = () => {
// destructure publish method from usePubSub hook
const { publish, messages } = usePubSub("RAISE_HAND");

const onPress = () => {
// RAISE HAND
const message = "";
publish(message, { persist: true });
};
return <>...</>;
};

Events

  1. onMessageReceived - onMessageReceived event will be triggered when a new message is published for the subscribed topic with the message object.
note

Check a detailed description of PubSub here.

Got a Question? Ask us on discord