tencent cloud

Tencent Real-Time Communication

お知らせ・リリースノート
製品アップデート情報
Tencent Cloudオーディオビデオ端末SDKの再生アップグレードおよび承認チェック追加に関するお知らせ
TRTCアプリケーションのサブスクリプションパッケージサービスのリリースに関する説明について
製品の説明
製品概要
基礎概念
製品の機能
製品の強み
ユースケース
性能データ
購入ガイド
Billing Overview
無料時間の説明
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
課金に関するよくあるご質問
Refund Instructions
初心者ガイド
Demo体験
Call
コンポーネントの説明(TUICallKit)
Activate the Service
Run Demo
クイック導入
オフライン通知
Conversational Chat
クラウドレコーディング(TUICallKit)
AI Noise Reduction
インターフェースのカスタマイズ
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
公開ログ
よくある質問
ライブ配信
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Demo のクイックスタート
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDKのダウンロード
APIコードサンプル
Usage Guidelines
クライアント側 API
高度な機能
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
コンソールガイド
アプリケーション管理
使用統計
監視ダッシュボード
開発支援
Solution
Real-Time Chorus
よくあるご質問
課金関連問題
機能関連
UserSig関連
ファイアウォールの制限の対応関連
インストールパッケージの圧縮に関するご質問
AndriodおよびiOS関連
Web端末関連
Flutter関連
Electron関連
TRTCCalling Web関連
オーディオビデオ品質関連
その他のご質問
旧バージョンのドキュメント
TUIRoom(Web)の統合
TUIRoom (Android)の統合
TUIRoom (iOS)の統合
TUIRoom (Flutter)の統合
TUIRoom (Electron)の統合
TUIRoom APIのクエリー
クラウドレコーディングと再生の実現(旧)
Protocols and Policies
セキュリティコンプライアンス認証
セキュリティホワイトペーパー
情報セキュリティの説明
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC ポリシー
プライバシーポリシー
データ処理とセキュリティ契約
用語集

CoHostStore

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-03-05 16:32:08

Introduction

Cross-room connection feature allows hosts from different live rooms to interact in real-time. CoHostStore provides a comprehensive set of APIs to manage the entire cross-room connection lifecycle.
Important:
Always use the factory method CoHostStore.create with a valid live room ID to create a CoHostStore instance. Do not attempt to initialize directly.
Note:
Connection state updates are delivered through the coHostState publisher. Subscribe to it to receive real-time updates about connection status, connected hosts, invitations and applications.
Warning:
If a connection request does not receive a response within the specified timeout, the timeout event will be triggered. Always handle timeout scenarios in your UI.

Features

Bidirectional Connection:Hosts can initiate connection requests to other hosts, and also receive connection requests from other hosts
State Management:Real-time tracking of connection status, connected hosts, invitation list and applicants
Event-Driven Architecture:Provides connection event stream for monitoring various connection state changes
Layout Templates:Supports multiple connection layout templates, such as dynamic grid layout and 1-to-6 layout

Subscribable Data

CoHostState fields are described below:
Property
Type
Description
coHostStatus
ValueListenable<CoHostStatus>
Real-time cross-room connection status.
connected
ValueListenable<List<SeatUserInfo>>
List of hosts currently connected with current live room.
invitees
ValueListenable<List<SeatUserInfo>>
List of hosts to whom requests have been sent.
applicant
ValueListenable<SeatUserInfo?>
Host who initiated connection request to current live room.
candidatesCursor
ValueListenable<String>
Recommended user list cursor.
candidates
ValueListenable<List<SeatUserInfo>>
Recommended user list.

API List

Function
Description
Create object instance.
Connection event callbacks.
Connection event callbacks.
Initiate connection request.
Cancel connection request.
Accept connection request.
Reject connection request.
Exit connection.
Get recommended host list.

Creating Instance

CoHostStore.create

Create object instance

Observing State and Events

addCoHostListener

Add connection callback listener
void addCoHostListener(CoHostListener listener);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
listener
Required
Listener.

removeCoHostListener

Remove connection callback listener
void removeCoHostListener(CoHostListener listener);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
listener
Required
Listener.

Connection Operations

requestHostConnection

Initiate host connection request
Future<CompletionHandler> requestHostConnection({
required String targetHostLiveID,
required CoHostLayoutTemplate layoutTemplate,
required int timeout,
String extraInfo = '',
});
Initiate a cross-room connection request to target host. After calling this method, a connection request is sent to the target host. The request will remain active until: • Target host accepts via acceptHostConnection(fromHostLiveID:completion:) • Target host rejects via rejectHostConnection(fromHostLiveID:completion:) • Timeout expires • You cancel via cancelHostConnection(toHostLiveID:completion:)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
targetHostLiveID
String
Required
Target host's live room ID.
layoutTemplate
Required
Connection layout template.
timeout
int
Required
Request timeout (unit: seconds).
extraInfo
String?
Required
Extension information.

cancelHostConnection

Cancel host connection request
Future<CompletionHandler> cancelHostConnection(String toHostLiveID);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
toHostLiveID
String
Required
Target host's live room ID.

acceptHostConnection

Accept host connection request
Future<CompletionHandler> acceptHostConnection(String fromHostLiveID);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
fromHostLiveID
String
Required
Live room ID of the host initiating connection request.

rejectHostConnection

Reject host connection request
Future<CompletionHandler> rejectHostConnection(String fromHostLiveID);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
fromHostLiveID
String
Required
Live room ID of the host initiating connection request.

exitHostConnection

Exit host connection
Future<CompletionHandler> exitHostConnection();
Version
Supported since version 3.5.

getCoHostCandidates

Get recommended host list that can connect with current host
Future<CompletionHandler> getCoHostCandidates(String cursor);
Version
Supported since version 3.5.
Parameters
Parameter
Type
Required
Description
cursor
String
Required
Cursor.

Data Structures

CoHostStatus

Current user's cross-room connection status
Enum Value
Value
Description
connected
0
Currently connected with other hosts.
disconnected
1
Not connected with other hosts.

CoHostLayoutTemplate

Connection layout template
Enum Value
Value
Description
hostVoiceConnection
2
Voice chat room connection layout.
hostDynamicGrid
600
Host dynamic grid layout.
hostDynamic1v6
601
Host dynamic 1v6 layout.

CoHostListener

Connection request callback events
Methods
Method
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.

CoHostState

Cross-room connection related state data provided externally by CoHostStore
Property
Type
Description
coHostStatus
ValueListenable<CoHostStatus>
Real-time cross-room connection status.
connected
ValueListenable<List<SeatUserInfo>>
List of hosts currently connected with current live room.
invitees
ValueListenable<List<SeatUserInfo>>
List of hosts to whom requests have been sent.
applicant
ValueListenable<SeatUserInfo?>
Host who initiated connection request to current live room.
candidatesCursor
ValueListenable<String>
Recommended user list cursor.
candidates
ValueListenable<List<SeatUserInfo>>
Recommended user list.

Usage Example

// Create store instance
final store = CoHostStore.create('live_room_123');

// Define listeners
late final VoidCallback statusListener = _onStatusChanged;
late final VoidCallback connectedListener = _onConnectedChanged;

void _onStatusChanged() {
print('Connection status: ${store.coHostState.coHostStatus.value}');
}

void _onConnectedChanged() {
print('Connected hosts: ${store.coHostState.connected.value.length}');
}

// Subscribe to state changes
store.coHostState.coHostStatus.addListener(statusListener);
store.coHostState.connected.addListener(connectedListener);

// Add connection event listener
final coHostListener = CoHostListener(
onCoHostRequestReceived: (inviter, extensionInfo) {
print('Received connection request from ${inviter.userName}');
// Show accept/reject UI
},
onCoHostRequestAccepted: (invitee) {
print('Connection request accepted by ${invitee.userName}');
},
onCoHostUserJoined: (userInfo) {
print('Host ${userInfo.userName} joined connection');
},
);
store.addCoHostListener(coHostListener);

// Initiate connection request
final result = await store.requestHostConnection(
targetHostLiveID: 'target_live_id',
layoutTemplate: CoHostLayoutTemplate.hostDynamicGrid,
timeout: 30,
extraInfo: '',
);
if (result.code == 0) {
print('Connection request sent successfully');
}

// Unsubscribe when done
store.coHostState.coHostStatus.removeListener(statusListener);
store.coHostState.connected.removeListener(connectedListener);
store.removeCoHostListener(coHostListener);

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック