TwilioChatClientDelegate Protocol Reference

Conforms to NSObject
Declared in TwilioChatClient.h

Overview

This protocol declares the chat client delegate methods.

– chatClient:connectionStateUpdated:

Called when the client connection state changes.

- (void)chatClient:(nonnull TwilioChatClient *)client connectionStateUpdated:(TCHClientConnectionState)state

Parameters

client

The chat client.

state

The current connection state of the client.

Discussion

Called when the client connection state changes.

Declared In

TwilioChatClient.h

– chatClientTokenExpired:

Called when the client’s token has expired.

- (void)chatClientTokenExpired:(nonnull TwilioChatClient *)client

Parameters

client

The chat client.

Discussion

Called when the client’s token has expired.

In response, your delegate should generate a new token and call chatClient:updateToken:completion: immediately as connection to the server has been lost.

Declared In

TwilioChatClient.h

– chatClientTokenWillExpire:

Called when the client’s token will expire soon.

- (void)chatClientTokenWillExpire:(nonnull TwilioChatClient *)client

Parameters

client

The chat client.

Discussion

Called when the client’s token will expire soon.

In response, your delegate should generate a new token and call chatClient:updateToken:completion: as soon as possible.

Declared In

TwilioChatClient.h

– chatClient:synchronizationStatusUpdated:

Called when the client synchronization state changes during startup.

- (void)chatClient:(nonnull TwilioChatClient *)client synchronizationStatusUpdated:(TCHClientSynchronizationStatus)status

Parameters

client

The chat client.

status

The current synchronization status of the client.

Discussion

Called when the client synchronization state changes during startup.

Declared In

TwilioChatClient.h

– chatClient:channelAdded:

Called when the current user has a channel added to their channel list.

- (void)chatClient:(nonnull TwilioChatClient *)client channelAdded:(nonnull TCHChannel *)channel

Parameters

client

The chat client.

channel

The channel.

Discussion

Called when the current user has a channel added to their channel list.

Declared In

TwilioChatClient.h

– chatClient:channel:updated:

Called when one of the current users channels is changed.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel updated:(TCHChannelUpdate)updated

Parameters

client

The chat client.

channel

The channel.

updated

An indication of what changed on the channel.

Discussion

Called when one of the current users channels is changed.

Declared In

TwilioChatClient.h

– chatClient:channel:synchronizationStatusUpdated:

Called when a channel the current the client is aware of changes synchronization state.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel synchronizationStatusUpdated:(TCHChannelSynchronizationStatus)status

Parameters

client

The chat client.

channel

The channel.

status

The current synchronization status of the channel.

Discussion

Called when a channel the current the client is aware of changes synchronization state.

Declared In

TwilioChatClient.h

– chatClient:channelDeleted:

Called when one of the current users channels is deleted.

- (void)chatClient:(nonnull TwilioChatClient *)client channelDeleted:(nonnull TCHChannel *)channel

Parameters

client

The chat client.

channel

The channel.

Discussion

Called when one of the current users channels is deleted.

Declared In

TwilioChatClient.h

– chatClient:channel:memberJoined:

Called when a channel the current user is subscribed to has a new member join.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel memberJoined:(nonnull TCHMember *)member

Parameters

client

The chat client.

channel

The channel.

member

The member.

Discussion

Called when a channel the current user is subscribed to has a new member join.

Declared In

TwilioChatClient.h

– chatClient:channel:member:updated:

Called when a channel the current user is subscribed to has a member modified.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel member:(nonnull TCHMember *)member updated:(TCHMemberUpdate)updated

Parameters

client

The chat client.

channel

The channel.

member

The member.

updated

An indication of what changed on the member.

Discussion

Called when a channel the current user is subscribed to has a member modified.

Declared In

TwilioChatClient.h

– chatClient:channel:memberLeft:

Called when a channel the current user is subscribed to has a member leave.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel memberLeft:(nonnull TCHMember *)member

Parameters

client

The chat client.

channel

The channel.

member

The member.

Discussion

Called when a channel the current user is subscribed to has a member leave.

Declared In

TwilioChatClient.h

– chatClient:channel:messageAdded:

Called when a channel the current user is subscribed to receives a new message.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel messageAdded:(nonnull TCHMessage *)message

Parameters

client

The chat client.

channel

The channel.

message

The message.

Discussion

Called when a channel the current user is subscribed to receives a new message.

Declared In

TwilioChatClient.h

– chatClient:channel:message:updated:

Called when a message on a channel the current user is subscribed to is modified.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel message:(nonnull TCHMessage *)message updated:(TCHMessageUpdate)updated

Parameters

client

The chat client.

channel

The channel.

message

The message.

updated

An indication of what changed on the message.

Discussion

Called when a message on a channel the current user is subscribed to is modified.

Declared In

TwilioChatClient.h

– chatClient:channel:messageDeleted:

Called when a message on a channel the current user is subscribed to is deleted.

- (void)chatClient:(nonnull TwilioChatClient *)client channel:(nonnull TCHChannel *)channel messageDeleted:(nonnull TCHMessage *)message

Parameters

client

The chat client.

channel

The channel.

message

The message.

Discussion

Called when a message on a channel the current user is subscribed to is deleted.

Declared In

TwilioChatClient.h

– chatClient:errorReceived:

Called when an error occurs.

- (void)chatClient:(nonnull TwilioChatClient *)client errorReceived:(nonnull TCHError *)error

Parameters

client

The chat client.

error

The error.

Discussion

Called when an error occurs.

Declared In

TwilioChatClient.h

– chatClient:typingStartedOnChannel:member:

Called when a member of a channel starts typing.

- (void)chatClient:(nonnull TwilioChatClient *)client typingStartedOnChannel:(nonnull TCHChannel *)channel member:(nonnull TCHMember *)member

Parameters

client

The chat client.

channel

The channel.

member

The member.

Discussion

Called when a member of a channel starts typing.

Declared In

TwilioChatClient.h

– chatClient:typingEndedOnChannel:member:

Called when a member of a channel ends typing.

- (void)chatClient:(nonnull TwilioChatClient *)client typingEndedOnChannel:(nonnull TCHChannel *)channel member:(nonnull TCHMember *)member

Parameters

client

The chat client.

channel

The channel.

member

The member.

Discussion

Called when a member of a channel ends typing.

Declared In

TwilioChatClient.h

– chatClient:notificationNewMessageReceivedForChannelSid:messageIndex:

Called as a result of TwilioChatClient’s handleNotification: method being invoked for a new message received notification. handleNotification: parses the push payload and extracts the new message’s channel and index for the push notification then calls this delegate method.

- (void)chatClient:(nonnull TwilioChatClient *)client notificationNewMessageReceivedForChannelSid:(nonnull NSString *)channelSid messageIndex:(NSUInteger)messageIndex

Parameters

client

The chat client.

channelSid

The channel sid for the new message.

messageIndex

The index of the new message.

Discussion

Called as a result of TwilioChatClient’s handleNotification: method being invoked for a new message received notification. handleNotification: parses the push payload and extracts the new message’s channel and index for the push notification then calls this delegate method.

Declared In

TwilioChatClient.h

– chatClient:notificationAddedToChannelWithSid:

Called as a result of TwilioChatClient’s handleNotification: method being invoked for an added to channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

- (void)chatClient:(nonnull TwilioChatClient *)client notificationAddedToChannelWithSid:(nonnull NSString *)channelSid

Parameters

client

The chat client.

channelSid

The channel sid for the newly added channel.

Discussion

Called as a result of TwilioChatClient’s handleNotification: method being invoked for an added to channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

Declared In

TwilioChatClient.h

– chatClient:notificationInvitedToChannelWithSid:

Called as a result of TwilioChatClient’s handleNotification: method being invoked for an invited to channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

- (void)chatClient:(nonnull TwilioChatClient *)client notificationInvitedToChannelWithSid:(nonnull NSString *)channelSid

Parameters

client

The chat client.

channelSid

The channel sid for the newly invited channel.

Discussion

Called as a result of TwilioChatClient’s handleNotification: method being invoked for an invited to channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

Declared In

TwilioChatClient.h

– chatClient:notificationRemovedFromChannelWithSid:

Called as a result of TwilioChatClient’s handleNotification: method being invoked for a removed from channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

- (void)chatClient:(nonnull TwilioChatClient *)client notificationRemovedFromChannelWithSid:(nonnull NSString *)channelSid

Parameters

client

The chat client.

channelSid

The channel sid for the removed channel.

Discussion

Called as a result of TwilioChatClient’s handleNotification: method being invoked for a removed from channel notification. handleNotification: parses the push payload and extracts the channel for the push notification then calls this delegate method.

Declared In

TwilioChatClient.h

– chatClient:notificationUpdatedBadgeCount:

Called when a processed push notification has changed the application’s badge count. You should call:

- (void)chatClient:(nonnull TwilioChatClient *)client notificationUpdatedBadgeCount:(NSUInteger)badgeCount

Parameters

client

The chat client.

badgeCount

The updated badge count.

Discussion

Called when a processed push notification has changed the application’s badge count. You should call:

UIApplication.sharedApplication.applicationIconBadgeNumber = badgeCount

Please note that badge count indicates the number of 1:1 (2 member only) channels that have unread messages. This will not reflect total unread message count or channels with more than 2 members.

To ensure your application’s badge updates when the application is in the foreground if Twilio is managing your badge counts. You may disregard this delegate callback otherwise.

Declared In

TwilioChatClient.h

– chatClient:user:updated:

Called when the current user’s or that of any subscribed channel member’s user is updated.

- (void)chatClient:(nonnull TwilioChatClient *)client user:(nonnull TCHUser *)user updated:(TCHUserUpdate)updated

Parameters

client

The chat client.

user

The object for changed user.

updated

An indication of what changed on the user.

Discussion

Called when the current user’s or that of any subscribed channel member’s user is updated.

Declared In

TwilioChatClient.h

– chatClient:userSubscribed:

Called when the client subscribes to updates for a given user.

- (void)chatClient:(nonnull TwilioChatClient *)client userSubscribed:(nonnull TCHUser *)user

Parameters

client

The chat client.

user

The object for subscribed user.

Discussion

Called when the client subscribes to updates for a given user.

Declared In

TwilioChatClient.h

– chatClient:userUnsubscribed:

Called when the client unsubscribes from updates for a given user.

- (void)chatClient:(nonnull TwilioChatClient *)client userUnsubscribed:(nonnull TCHUser *)user

Parameters

client

The chat client.

user

The object for unsubscribed user.

Discussion

Called when the client unsubscribes from updates for a given user.

Declared In

TwilioChatClient.h