Room
Methods
JoinRoom
After initializing Huddle01 plugin, you can call JoinRoom function and subscribe to Huddle01Core.OnJoinRoom
Event
Note that this example hardcodes a token. In a real app, you’ll need your server to generate a token for you. Click here
to refer
Name | Type | Description |
---|---|---|
roomId | string | Id of room |
token | string | access token |
.csharp
private void OnEnable()
{
Huddle01Core.OnJoinRoom += OnJoinRoom;
}
private void OnDisable()
{
Huddle01Core.OnJoinRoom -= OnJoinRoom;
}
public void JoinRoom(string roomId,string token)
{
Huddle01Core.Instance.JoinRoom(roomId, token);
}
private void OnJoinRoom()
{
Debug.Log("Room Joined");
}
LeaveRoom
Call Huddle01Core.Instance.LeaveRoom method to leave the current room
.csharp
public void LeaveRoom()
{
Huddle01Core.Instance.LeaveRoom();
//post leave room
}
RoomClosed
Subscribe to Huddle01Core.RoomClosed
event incase room is closed
.csharp
private void OnEnable()
{
Huddle01Core.RoomClosed += OnRoomClosed;
}
private void OnDisable()
{
Huddle01Core.RoomClosed -= OnRoomClosed;
}
private void OnRoomClosed()
{
Debug.Log("Current room closed");
}
Events
Huddle01Core.JoinRoomEventHandler OnJoinRoom
This is called in room joined successfully
Huddle01Core.RoomClosedEventHandler RoomClosed
This is called in room is closed successfully