Co Guest Store
Live co-guest management related interfaces, managing co-guest application, invitation, acceptance, rejection and other operations between hosts and audience.
Overview
CoGuestStore Manages all co-guest related operations between hosts and audience, including application, invitation, acceptance and rejection processes. Co-guest feature enables real-time interaction between hosts and audience members through a seat-based system. CoGuestStore provides a comprehensive set of APIs to manage the entire co-guest lifecycle.
Core Features
Bidirectional Invitation: Hosts can invite audience members, and audience members can also apply to join
State Management: Real-time tracking of connected users, invitations and applications
Event-Driven Architecture: Provides separate event streams for host and guest roles
Timeout Handling: Built-in timeout mechanism for invitations and applications
Important: Always use the method CoGuestStore.create with a non-empty string liveID to create a
CoGuestStoreinstance. Do not attempt to initialize directly. Co-guest state updates are delivered through the coGuestState publisher. Subscribe to it to receive real-time updates about connected users, invitations and applications.
Co-Guest Workflow
The following table shows a typical co-guest workflow:
| Step | Role | Action | Triggered Event |
| 1 | Audience | Call applyForSeat | HostListener.onGuestApplicationReceived |
| 2 | Host | Call acceptApplication | GuestListener.onGuestApplicationResponded |
| 3 | System | User connects to seat | State updated through coGuestState publisher |
Host-Initiated Flow
| Step | Role | Action | Triggered Event |
| 1 | Host | Call inviteToSeat | GuestListener.onHostInvitationReceived |
| 2 | Audience | Call acceptInvitation | HostListener.onHostInvitationResponded |
| 3 | System | User connects to seat | State updated through coGuestState publisher |
Warning: If a co-guest request does not receive a response within the specified timeout, an event with
NoResponseReason.timeoutwill be triggered. Always handle timeout scenarios in your UI.
Usage Example
// Create store instance
val store = CoGuestStore.create("live_room_123")
// Subscribe to state changes
lifecycleScope.launch {
store.coGuestState.connected.collect { connected ->
println("Connected users: ${connected.size}")
}
}
// Add host event listener (for hosts)
store.addHostListener(object : HostListener() {
override fun onGuestApplicationReceived(guestUser: LiveUserInfo) {
println("Received application from ${guestUser.userName}")
// Show accept/reject UI
}
override fun onHostInvitationResponded(isAccept: Boolean, guestUser: LiveUserInfo) {
println("Audience ${guestUser.userName} ${if (isAccept) "accepted" else "rejected"}")
}
})
// Host: Accept application
store.acceptApplication("user_456") { code, message ->
if (code == 0) {
println("Application accepted successfully")
}
}Warning: Warning: If a co-guest request does not receive a response within the specified timeout, an event with
NoResponseReason.timeoutwill be triggered. Always handle timeout scenarios in your UI.
Topics
Creating Instance
CoGuestStore.create - Create object instance
Observing State and Events
coGuestState - Reactive state containing connected users, invitees, applicants and candidates
addHostListener/removeHostListener - Host-side event callbacks
addGuestListener/removeGuestListener - Guest-side event callbacks
Guest Operations
applyForSeat - Guest applies for co-guest
cancelApplication - Guest cancels application
acceptApplication/rejectApplication - Host responds to application
Host Operations
inviteToSeat - Host invites guest to co-guest
cancelInvitation - Host cancels invitation
acceptInvitation/rejectInvitation - Guest responds to invitation
Connection Control
disconnect - End co-guest session
See Also
Functions
Accept seat application
Accept seat invitation
Add guest-side event callback listener
Add host-side event callback listener
Apply to go on seat
Cancel a previously sent co-guest application. After calling this method, all hosts will be notified of the application cancellation.
Cancel seat invitation
Disconnect co-guest
Invite audience to seat
Reject seat application
Reject seat invitation
Remove guest-side event callback listener
Remove host-side event callback listener