Anchor Connection
Description of the Feature
The connection feature is a real-time interactive communication method, customized for anchors. It enables anchors from different rooms to interact and communicate in real-time during the livestream. TUILiveKit's connection feature supports up to nine people in a single room simultaneously. It provides strong technical support for various scenarios such as anchor interaction, knowledge sharing, cultural exchange, and e-commerce training. It offers diverse interactive methods for anchors and enriches the viewing experience for the audience, creating more surprises and value for both parties, and making livestreams more attractive.
Two-person connection | Multiple people connection |
| |
Access Process
Anchor Connection Process
The TUILiveKit anchor connection feature is mainly implemented based on LiveCoreView. You can use the following API to complete the anchor connection feature. Here is an example of connection between Anchor A and Anchor B.
Note:
The following are active call methods provided by LiveCoreView.
All callback methods refer to the callback methods in the ConnectionObserver object set by LiveCoreView.
Anchor A initiates the connection
Anchor A initiates the connection by calling requestCrossRoomConnection and passing the room ID of anchor B in the roomId parameter.
let roomId = "anchorRoomId"liveCoreView.requestCrossRoomConnection(roomId: roomId, timeOut: 10) {} onError: { code, message in}
Anchor A can receive the request acceptance callback through onCrossRoomConnectionAccepted.
Anchor B receives the connection request
Anchor B receives the connection request callback through onCrossRoomConnectionRequest.
func onCrossRoomConnectionRequest(hostUser: TUIConnectionUser) {print("Received a connection request from anchor A's room:\(inviterUser.userId)")}
Anchor B responds to the connection request by calling respondToCrossRoomConnection.
liveCoreView.respondToCrossRoomConnection(roomId: roomId, isAccepted: true) {} onError: { code, message in}
Anchor A, anchor B, and the audience in the room receive the onConnectedRoomsUpdated callback and get notified of the changes in the connection list.
func onConnectedRoomsUpdated(hostUserList: [TUIConnectionUser]) {print("The anchor connection room list has been updated")}
Exit connection process
Anchor B exits the connection by calling terminateCrossRoomConnection
liveCoreView.terminateCrossRoomConnection()
Anchor A, anchor B, and the audience in the room receive the onConnectedRoomsUpdated callback and get notified of the changes in the connection list.
func onConnectedRoomsUpdated(hostUserList: [TUIConnectionUser]) {print("The anchor connection room list has been updated")}
Note:
The connection feature is implemented based on LiveCoreView. If you need to extend the connection feature, please refer to the LiveCoreView documentation.
Anchor connection sequence diagram