Seamless Membership Management: Channel membership operations provide reliable joining and leaving functionality with idempotent behavior. Once joined, users can participate in conversations and receive updates, while membership status can be observed in real-time for dynamic UI updates.
Membership Operations
Channel membership management supports both joining and leaving operations with automatic membership tracking and real-time status updates.Join Channels
Become a channel member
- Idempotent operation with safe retry behavior
- Immediate participation in conversations
- Automatic membership status updates
Leave Channels
Remove membership from channels
- Clean disconnection from channel activity
- Stop receiving messages and updates
- Permanent membership removal
Membership Management
Add user to channel membershipThe
joinChannel
function allows users to join a channel, making them a member of the channel. This function takes one parameter, channelId
which is the ID of the channel that the user wishes to join.Once the user joins the channel, they will be able to participate in conversations and receive updates about the channel’s activity. It is important to note that this function is idempotent, which means that it can be called multiple times without causing any issues. If the user has already joined the channel, a successful result will still be returned.Parameters
Parameter | Type | Required | Description |
---|---|---|---|
channelId | String | ✅ | Unique identifier of the channel to join |
Code Examples
Idempotent Operation: This function can be called multiple times safely. If the user has already joined the channel, a successful result will still be returned without any issues.
Channel Membership Concepts
Understanding the relationship between different channel operations is crucial for effective membership management:Operation Differences
Create vs Join vs Get Channel
Create vs Join vs Get Channel
Understanding channel operation distinctionsEach channel is identified by a unique
channelId
, which is any string that uniquely identifies the channel and is immutable through its lifetime. When creating channels, you can specify your own channelId
, or leave it to social.plus’s Chat SDK to automatically generate one for you.Key Differences:createChannel
: Guarantees that the requested channel is new (except forconversation
type)joinChannel
: Attempts to join an existing channel and adds user to membershipgetChannel
: Only retrieves the channel Live Object but doesn’t make the current user join the channel
Membership Status Management
Membership Status Management
Real-time membership monitoringWhen a user joins a channel, they can observe and chat with other users in that channel. They are also automatically considered a member of that channel. The Chat SDK provides the ability to view which users are currently in the channel as well as invite other users to join the channel.Membership Benefits:
- Participate in conversations and send messages
- Receive real-time updates about channel activity
- Access to channel history and member information
- Ability to observe membership changes in real-time
- Observe membership changes for dynamic UI updates
- Handle banned status appropriately with user redirection
- Track member additions and removals for activity indicators
- Implement appropriate error handling for membership failures
Error Handling & Edge Cases
Error Handling & Edge Cases
Robust membership operation handlingCommon Scenarios:
- Channel Not Found: Handle cases where the channel ID doesn’t exist
- Permission Denied: Manage situations where users lack join permissions
- Already Member: Leverage idempotent behavior for safe retry operations
- Banned Users: Implement appropriate UI flow for banned status
- Always check membership status before performing channel operations
- Implement proper error handling with user-friendly messages
- Use membership observation for dynamic UI state management
- Handle network failures with appropriate retry mechanisms
Next Steps
Query Members
Search and retrieve channel members
Member Management
Advanced member administration and permissions
Channel Creation
Create new channels for conversations
Membership Strategy: Use the idempotent nature of
joinChannel
to safely retry operations, and always observe membership status for dynamic UI updates, especially to handle banned user scenarios gracefully.