-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuseMuppetChannels.jsx
More file actions
30 lines (26 loc) · 1.1 KB
/
useMuppetChannels.jsx
File metadata and controls
30 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* --------------------------------------------------------------------------------
* Created on Wed Nov 6 2024
*
* Copyright (c) 2024 Colorado State University. All rights reserved. (1)
*
* Contributors:
* Mackenzie Grimes (1)
*
* --------------------------------------------------------------------------------
*/
import { useContext } from 'react';
import { MuppetContext } from '../MuppetProvider';
// eslint-disable-next-line no-unused-vars
import MuppetChannel from '../MuppetChannel';
/**
* Fetch active channel to subscribe/send MUPPET messages to other apps in your app suite over MUPPET.
* Channel may be null if connections haven't been attempted yet.
*
* @returns {@type {Object.<string, MuppetChannel | null>}} objects of the active ```MuppetChannel```
* instances, where each object key is the WebRTC/MUPPET room name string passed to in the `channels`
* property to `MuppetProvider`.
*
* These channels can then be used with methods such as ```MuppetChannel.sendEvent()``` to send events
*/
const useMuppetChannels = () => useContext(MuppetContext);
export default useMuppetChannels;