@@ -13,7 +13,8 @@ type UseDataChannelReturnType<T extends string | undefined = undefined> = {
1313
1414/**
1515 * The `useDataChannel` hook returns the ability to send and receive messages.
16- * By optionally passing a `topic`, you can narrow down which messages are returned in the messages array.
16+ * Pass an optional `topic` to narrow down which messages are returned in the messages array.
17+ *
1718 * @remarks
1819 * There is only one data channel. Passing a `topic` does not open a new data channel.
1920 * It is only used to filter out messages with no or a different `topic`.
@@ -23,23 +24,23 @@ type UseDataChannelReturnType<T extends string | undefined = undefined> = {
2324 * // Send messages to all participants via the 'chat' topic.
2425 * const { message: latestMessage, send } = useDataChannel('chat', (msg) => console.log("message received", msg));
2526 * ```
27+ *
28+ * @example
29+ * ```tsx
30+ * // Receive all messages (no topic filtering)
31+ * const { message: latestMessage, send } = useDataChannel((msg) => console.log("message received", msg));
32+ * ```
33+ *
2634 * @public
2735 */
2836export function useDataChannel < T extends string > (
2937 topic : T ,
3038 onMessage ?: ( msg : ReceivedDataMessage < T > ) => void ,
3139) : UseDataChannelReturnType < T > ;
40+
3241/**
33- * The `useDataChannel` hook returns the ability to send and receive messages.
34- * @remarks
35- * There is only one data channel. Passing a `topic` does not open a new data channel.
36- * It is only used to filter out messages with no or a different `topic`.
42+ * Overload for `useDataChannel` without a topic. See {@link (useDataChannel:1)} for information and usage examples.
3743 *
38- * @example
39- * ```tsx
40- * // Send messages to all participants
41- * const { message: latestMessage, send } = useDataChannel('chat', (msg) => console.log("message received", msg));
42- * ```
4344 * @public
4445 */
4546export function useDataChannel (
0 commit comments