Skip to main content

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 to 1 when calling the API.

Add to Blocklist

Call addToBlacklist to add a user to the blocklist.

tip

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)
})
ParameterTypeDescription
userIdstringUser ID

Remove from Blocklist

Call removeFromBlacklist to remove a user from the blocklist.

tip

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)
})
ParameterTypeDescription
userIdstringUser ID

Get Blocklist

Call getBlacklist to retrieve the blocklist.

tip

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.

tip

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)
})
ParameterTypeDescription
userIdstringUser ID