/ SDKs / iOS
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
Version 4

Add or remove a user event delegate

Copy link

To receive information about events related to users connected to the Sendbird server, add a user event delegate UserEventDelegate) with its unique user-defined ID.

If you want to stay informed of changes related to users and notify the changes to different client apps, define and register multiple user event delegates to each view controller.

User event types

Copy link

List of user events

Copy link
MethodInvoked whenNotified devices


There has been an update on the total number of a user's unread messages because the user read messages in group channels.

The user's devices running client apps. The devices are notified with the total number of unread messages along with a collection of the number of unread messages by custom channel type.

Add a user event delegate

Copy link

The following code shows a full set of supported event callbacks with their parameters and how to add a user event delegate to the unique SendbirdChat instance.

Note: The totalCountByCustomType attribute is turned off by default. Contact us if you wish to use this feature.

// CustomViewController.swift
class CustomViewController: UIViewController, UserEventDelegate {
    func initViewController() {
        SendbirdChat.add(self as UserEventDelegate, identifier: UNIQUE_DELEGATE_ID)

    func didUpdateTotalUnreadMessageCount(_ totalCount: Int32, totalCountByCustomType: [String : NSNumber]?) {


Remove a user event delegate

Copy link

The following code shows how to remove the user event delegate.

SendbirdChat.removeUserEventDelegate(forIdentifier: UNIQUE_DELEGATE_ID)