Skip to main content
POST
/
tmpchannel
/
subscriber_set
curl -X POST "http://localhost:5001/tmpchannel/subscriber_set" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "tmp_channel_123",
    "uids": ["user1", "user2", "user3"]
  }'
{
  "status": "ok"
}
This interface is primarily used for internal system calls and cluster node communication. External direct use is not recommended.

Overview

Set subscribers for a temporary channel. This is an internal API used for cluster node communication to manage temporary channel subscriptions. Temporary channels are used for special scenarios such as temporary groups or sessions, and automatically create and manage channel tags.

Request Body

Required Parameters

channel_id
string
required
Temporary channel ID, cannot contain special characters
uids
array
required
List of user IDs to set as subscribers for the temporary channel
uids[]
string
User ID
curl -X POST "http://localhost:5001/tmpchannel/subscriber_set" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "tmp_channel_123",
    "uids": ["user1", "user2", "user3"]
  }'
{
  "status": "ok"
}

Response Fields

status
string
required
Operation status, returns "ok" on success

Status Codes

Status CodeDescription
200Temporary channel subscribers set successfully
400Request parameter error
500Internal server error

Temporary Channel Mechanism

Temporary Channel Features

  • Temporary Nature: Used for special scenarios like temporary groups or sessions
  • Auto Management: System automatically creates and manages channel tags
  • Cluster Communication: Primarily used for internal communication between cluster nodes
  • Subscription Management: Supports dynamic setting of subscriber lists

Use Cases

ScenarioDescriptionApplicable Situation
Temporary GroupsCreate temporary discussion groupsShort-term project collaboration
Session MigrationMigrate sessions between cluster nodesLoad balancing
System MaintenanceTemporarily reorganize channel structureSystem upgrades

Important Notes

Internal API WarningThis interface is designed for internal system calls. Direct use may cause:
  • Data inconsistency
  • Cluster state anomalies
  • Unexpected system behavior
It is recommended to use standard channel management interfaces for regular operations.

Parameter Restrictions

  • Channel ID: Cannot be empty, cannot contain special characters
  • User List: Must contain at least one user ID
  • Character Length: Channel ID maximum 64 characters

Error Handling

Error MessageCauseSolution
channel_id cannot be emptyNo channel ID providedEnsure valid channel ID is provided
uids cannot be emptyUser list is emptyProvide at least one user ID
Channel ID cannot contain special charactersInvalid channel ID formatUse alphanumeric characters and underscores
Failed to get channel’s cluster nodeCluster communication errorCheck cluster status
Failed to create tagTag system errorCheck tag service status

Best Practices

  1. Internal Use Only: Avoid calling directly in client applications
  2. Parameter Validation: Ensure all parameters are correctly formatted
  3. Error Handling: Implement comprehensive error handling mechanisms
  4. Monitor Logs: Record API calls for troubleshooting
  5. Cluster Status: Ensure cluster status is normal before calling