Binding RTC Rooms
- The binding RTC room interface is supported starting from client SDK version 5.2.1.
- This interface is located in the
RCChatRoomClientclass.
Use Case: Chatrooms have an auto-destruction mechanism. For apps using RC's RTC services that also utilize IMLib SDK's chatroom features for live chat, bullet comments, or attribute recording, consider binding chatrooms with RTC rooms. This ensures chatrooms won't be destroyed before voice chat or live streaming ends, preventing critical data loss. (When using chatroom services independently, this interface is unnecessary.)
After binding an RTC room, when a chatroom meets preset auto-destruction conditions, the server first checks whether the bound RTC room (RTCRoomId) still exists:
- If the bound RTC room exists, the chatroom won't be destroyed.
- If the bound RTC room has been destroyed, the chatroom will be destroyed immediately.
This interface only establishes a one-way binding from chatroom to RTC room. Therefore, after binding, the active or automatic destruction of the RTC room won't directly trigger the destruction of the chatroom. For details about RTC room destruction mechanisms, see RTC Room Destruction Mechanism.
Notes on Chatroom Auto-Destruction Logic:
Chatrooms have an auto-destruction mechanism. By default, all chatrooms will automatically remove all members and self-destruct after 1 hour of inactivity (no member joins/exits or new messages). This duration can be extended or configured for scheduled auto-destruction. See server documentation Chatroom Destruction Mechanism for details.
This interface requires a chatroom ID parameter, so it must be called after the chatroom is successfully created. The client automatically completes creation and joining when calling the join chatroom interface.
This interface doesn't include user permission controls. It's recommended that business-side room owners or hosts call it once after successfully joining the chatroom, while other users don't need to call it.
Interface Prototype
- (void)bindChatRoom:(NSString *)chatRoomId withRTCRoom:(NSString *)rtcRoomId success:(void(^)(void))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| chatRoomId | NSString | Chatroom ID (non-empty). The chatroom must already exist. Maximum length: 64 characters. |
| rtcRoomId | NSString | RC RTC room ID (non-empty). Provided by the app. |
| successBlock | Block | Success callback |
| errorBlock | Block | Failure callback |
Sample Code
[[RCChatRoomClient sharedChatRoomClient] bindChatRoom:@"chatRoomId" withRTCRoom:@"rtcRoomId" success:^{
} error:^(RCErrorCode nErrorCode) {
}];