Skip to main content
Directions: .byMe | .me | .both (default)
Blocking a user prevents all communication between them and the logged-in user — messages, calls, and presence updates are all suppressed. You can block and unblock users by UID, and fetch the blocked users list with filtering and pagination.

Block Users

Block users to prevent all communication with them. Use blockUsers() with an array of UIDs.
Returns a dictionary with UIDs as keys and "success" or "fail" as values based on if the block operation for each UID was successful.

Unblock Users

Unblock previously blocked users using unblockUsers() with an array of UIDs.
Returns a dictionary with UIDs as keys and "success" or "fail" as values based on if the unblock operation for each UID was successful.

Get List of Blocked Users

Use BlockedUsersRequestBuilder to fetch blocked users with filtering and pagination.

Set Limit

Sets the number of blocked users to fetch per request.

Set Search Keyword

Filters blocked users by a search string.

Set Direction

Filters by block direction:
  • .byMe — Users blocked by the logged-in user
  • .me — Users who have blocked the logged-in user
  • .both — Both directions (default)
After configuring the builder, call build() to get the BlockedUsersRequest object, then call fetchNext() to retrieve blocked users.
The fetchNext() method returns an array of User objects representing blocked users. Relevant fields to access on returned users:

Offline support

With offline support enabled (SDK 4.2.0 or later), fetchNext on a BlockedUserRequest has an overload that first delivers onCachedUsers from the SDK’s own blocked-users list. The SDK refreshes that list on login and on each catch-up sync, and updates it when you call blockUsers or unblockUsers. The first cached page holds the whole list and later pages are empty. Then onServerUsers delivers the live page to reconcile by uid. The cached page is empty when no users are blocked or when set(searchKeyword:) is set. Offline, the read ends with onError, code ERROR_INTERNET_UNAVAILABLE, after the cached page. Blocking and unblocking need a connection and are not queued. See Show Cached Data.

Next Steps

Retrieve Users

Fetch and filter user lists

User Presence

Track online/offline status of users

User Management

Create, update, and delete users

Flag Message

Report inappropriate messages from users