Documentation
TalkingRoom Live Audio Room
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Live Audio Room
  • Guides
  • Manage rooms

Manage rooms

Last updated:2022-03-22 13:07

Rooms provide basic signaling capabilities for providing orderly and reliable real-time signaling. This document describes how to manage rooms.


Prerequisites

  • Contact the ZEGO sales team or pre-sales engineer to configure the Live Audio Room (RTC + IM) service.
  • Refer to the Getting started to create a room or join a room.

Obtain the room state and room info

To obtain the room state and room info, set the delegate to self and listen for the callback receiveRoomInfoUpdate.

RoomManager.shared.roomService.delegate = self

/// Callback for the room status update
///
/// Description: This callback will be triggered when the text chat is disabled or there is a speaker seat be closed in the room. And all uses in the room receive a notification through this callback.
///
/// @param roomInfo refers to the updated room information.
func receiveRoomInfoUpdate(_ info: RoomInfo?) {
    // This callback will be triggered when room info changes.
}

Receive the in-room participant updates

To receive the updates when new participants join the room or existing participants leave the room, call the addUserServiceDelegate method, and listen for the roomUserJoin and roomUserLeave callbacks.

RoomManager.shared.userService.addUserServiceDelegate(self)

/// Callback for new user joins the room
///
/// Description: This callback will be triggered when a new user joins the room, and all users in the room will receive a notification. The in-room user list data will be updated automatically.
///
/// @param userList refers to the latest new-comer user list. Existing users are not included.
func roomUserJoin(_ users: [UserInfo]) {
    // This callback will be triggered when new participants join the room.
}

/// Callback for existing user leaves the room
///
/// Description: This callback will be triggered when an existing user leaves the room, and all users in the room will receive a notification. The in-room user list data will be updated automatically.
///
/// @param userList refers to the list of users who left the room.
func roomUserLeave(_ users: [UserInfo]) {   
    // This callback will be triggered when existing participants leave the room. 
}
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code