Property | Type | Description |
coHostStatus | Real-time cross-room connection status. | |
connected | List of hosts currently connected with current live room. | |
invitees | List of hosts to whom requests have been sent. | |
applicant | Host who initiated connection request to current live room. | |
candidatesCursor | String | Recommended user list cursor. |
candidates | Recommended user list. |
Function | Description |
Create object instance. | |
Connection event publisher. | |
Initiate connection request. | |
Cancel connection request. | |
Accept connection request. | |
Reject connection request. | |
Exit connection. | |
Get recommended host list. |
public static func create(liveID: String) -> CoHostStore {let store: CoHostStoreImpl = StoreFactory.shared.getStore(liveId: liveID)return store}
Parameter | Type | Required | Description |
liveID | String | Required | Live room ID. |
public func requestHostConnection(targetHost liveId: String,layoutTemplate: CoHostLayoutTemplate,timeout: TimeInterval,extraInfo: String = "",completion: CompletionClosure?){fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
liveId | String | Required | Target host's live room ID. |
layoutTemplate | Required | Connection layout template. | |
timeout | TimeInterval | Required | Request timeout (unit: seconds). |
extraInfo | String | Required | Extension information. |
completion | Required | Callback for successful request initiation. |
public func cancelHostConnection(toHostLiveID: String, completion: CompletionClosure?) {fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
toHostLiveID | String | Required | Target host's live room ID. |
completion | Required | Callback for successful cancellation. |
public func acceptHostConnection(fromHostLiveID: String, completion: CompletionClosure?) {fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
fromHostLiveID | String | Required | Live room ID of the host initiating connection request. |
completion | Required | Callback for successful acceptance. |
public func rejectHostConnection(fromHostLiveID: String, completion: CompletionClosure?) {fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
fromHostLiveID | String | Required | Live room ID of the host initiating connection request. |
completion | Required | Callback for successful rejection. |
public func exitHostConnection(completion: CompletionClosure? = nil) {fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
completion | Required | Callback for successful exit from connection. |
public func getCoHostCandidates(cursor: String,completion: CompletionClosure?) {fatalError("\\(#function) must be overridden by subclass")}
Parameter | Type | Required | Description |
cursor | String | Required | Cursor. |
completion | Required | Completion callback. |
Enum Value | Value | Description |
connected | 0 | Currently connected with other hosts. |
disconnected | 1 | Not connected with other hosts. |
Enum Value | Value | Description |
hostVoiceConnection | 2 | Voice chat room connection layout. |
hostDynamicGrid | 600 | Host dynamic grid layout. |
hostDynamic1v6 | 601 | Host dynamic 1v6 layout. |
Enum Value | Description |
onCoHostRequestReceived | This callback is triggered when a connection request is received. |
onCoHostRequestCancelled | This callback is triggered when a connection request is cancelled. |
onCoHostRequestAccepted | This callback is triggered when a connection request is accepted. |
onCoHostRequestRejected | This callback is triggered when a connection request is rejected. |
onCoHostRequestTimeout | This callback is triggered when a connection request times out. |
onCoHostUserJoined | This callback is triggered when a user joins the connection. |
onCoHostUserLeft | This callback is triggered when a user leaves the connection. |
Property | Type | Description |
coHostStatus | Real-time cross-room connection status. | |
connected | List of hosts currently connected with current live room. | |
invitees | List of hosts to whom requests have been sent. | |
applicant | Host who initiated connection request to current live room. | |
candidatesCursor | String | Recommended user list cursor. |
candidates | Recommended user list. |
// Create store instancelet store = CoHostStore.create(liveID: "live_room_123")// Subscribe to state changesstore.state.subscribe { state inprint("Connection status: \\(state.coHostStatus)")print("Connected hosts: \\(state.connected.count)")}// Subscribe to connection eventsstore.coHostEventPublisher.sink { event inswitch event {case .onCoHostRequestReceived(let inviter, let extensionInfo):print("Received connection request from \\(inviter.userName)")// Show accept/reject UIcase .onCoHostRequestAccepted(let invitee):print("Connection request accepted by \\(invitee.userName)")case .onCoHostUserJoined(let userInfo):print("Host \\(userInfo.userName) joined connection")default:break}}// Initiate connection requeststore.requestHostConnection(targetHost: "target_live_id",layoutTemplate: .hostDynamicGrid,timeout: 30,extraInfo: "",completion: { code, message inif code == 0 {print("Connection request sent successfully")}})
Feedback