Blocklist Management (Electron)
This feature is currently limited to use in the Electron solution.
After adding a user to the blocklist, you will no longer receive any one-to-one chat messages from them.
- Adding a user to the blocklist is a one-way operation. For example, if User A blocks User B, it means B cannot send messages to A (error code
405
). However, A can still send messages to B, and B will receive them normally. - There is a limit to the total number of users that can be added to a single user's blocklist, which depends on the pricing plan. The limit is 3000 users for the Chat Premium Plan and Chat Ultimate Plan. For other plans, please refer to the Service Limits section in the Feature Comparison Table.
- Sending one-to-one chat messages via the server API is not restricted by the blocklist by default. To enable this restriction, set
verifyBlacklist
to1
when calling the API.
Add to Blocklist
Call addToBlacklist to add a user to the blocklist.
This interface is supported starting from SDK 5.4.0. This feature is currently limited to use in the Electron solution.
RongIMLib.addToBlacklist('<userId>').then(res => {
console.log(res.code)
})
Parameter | Type | Description |
---|---|---|
userId | string | User ID |
Remove from Blocklist
Call removeFromBlacklist to remove a user from the blocklist.
This interface is supported starting from SDK 5.4.0. This feature is currently limited to use in the Electron solution.
RongIMLib.removeFromBlacklist('<userId>').then(res => {
console.log(res.code)
})
Parameter | Type | Description |
---|---|---|
userId | string | User ID |
Get Blocklist
Call getBlacklist to retrieve the blocklist.
This interface is supported starting from SDK 5.4.0. This feature is currently limited to use in the Electron solution.
RongIMLib.getBlacklist().then(res => {
console.log(res)
})
Check if a User is in the Blocklist
Call getBlacklistStatus to check if a specific user is in the blocklist.
This interface is supported starting from SDK 5.4.0. This feature is currently limited to use in the Electron solution.
RongIMLib.getBlacklistStatus('<userId>').then(res => {
console.log(res)
})
Parameter | Type | Description |
---|---|---|
userId | string | User ID |