Optional
onMessage: ((msg: ReceivedDataMessage<T>) => void)The useDataChannel
hook returns the ability to send and receive messages.
There is only one data channel. Passing a topic
does not open a new data channel.
It is only used to filter out messages with no or a different topic
.
// Send messages to all participants
const { message, send } = useDataChannel(callback);
Optional
onMessage: ((msg: ReceivedDataMessage<string>) => void)Generated using TypeDoc
The
useDataChannel
hook returns the ability to send and receive messages. By optionally passing atopic
, you can narrow down which messages are returned in the messages array.Remarks
There is only one data channel. Passing a
topic
does not open a new data channel. It is only used to filter out messages with no or a differenttopic
.Example