Shinigami Hooks
useLobby

useLobby

The useLobby hook allows you to interact with peers in the lobby, i.e. who are waiting to join a locked room. As an admin, you can choose to admit these peers into the room or deny them from joining the room.

const {
    lobbyPeers,
    admitPeer,
    denyPeer
  } = useLobby({
    onLobbyPeersUpdated(lobbyPeers) {},
  });

Props

The useLobby hook accepts an object with the following fields as props.

1. onLobbyPeersUpdatedOptional
DescriptionReturn Type
This function will be called when the peers waiting in lobby are updated.void
Parameter NameTypeDescriptionRequired
lobbyPeersstring[]Array of peerIds of peers waiting in lobbyYes
Example Usage
const lobby = useLobby({ onLobbyPeersUpdated: (lobbyPeers) => {
	console.log("Peers in lobby who are waiting to join updated!");
    console.log(lobbyPeers);
    // your code here
}});

Returns

The useLobby hook returns an object with the following fields.

1. lobbyPeersArray
DescriptionType
List of peerIds of the peers in lobby who are waiting to join a locked roomstring[]
2. admitPeerFunction
DescriptionReturn Type
Admit a peer into the room.void
Parameter NameTypeDescriptionRequired
peerIdstringpeerId of the waiting peer you want to admit into the room.Yes
2. denyPeerFunction
DescriptionReturn Type
Deny a peer from joining the room.void
Parameter NameTypeDescriptionRequired
peerIdstringpeerId of the waiting peer you want to deny joining the room.Yes
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.