TwilioConversationsClientDelegate Protocol Reference
| Conforms to | NSObject | 
|---|---|
| Declared in | TCHConversationsClient.h | 
– conversationsClient:connectionStateUpdated:
	Called when the client connection state changes.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client connectionStateUpdated:(TCHClientConnectionState)stateParameters
| client | The conversations client. | 
|---|---|
| state | The current connection state of the client. | 
Discussion
Called when the client connection state changes.
Declared In
TCHConversationsClient.h
– conversationsClientTokenExpired:
	Called when the client’s token has expired.
- (void)conversationsClientTokenExpired:(nonnull TwilioConversationsClient *)clientParameters
| client | The conversations client. | 
|---|
Discussion
Called when the client’s token has expired.
In response, your delegate should generate a new token and call
conversationsClient:updateToken:completion: immediately as connection to
the server has been lost.
Declared In
TCHConversationsClient.h
– conversationsClientTokenWillExpire:
	Called when the client’s token will expire soon.
- (void)conversationsClientTokenWillExpire:(nonnull TwilioConversationsClient *)clientParameters
| client | The conversations client. | 
|---|
Discussion
Called when the client’s token will expire soon.
In response, your delegate should generate a new token and call
conversationsClient:updateToken:completion: as soon as possible.
Declared In
TCHConversationsClient.h
– conversationsClient:synchronizationStatusUpdated:
	Called when the client synchronization state changes during startup.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client synchronizationStatusUpdated:(TCHClientSynchronizationStatus)statusParameters
| client | The conversations client. | 
|---|---|
| status | The current synchronization status of the client. | 
Discussion
Called when the client synchronization state changes during startup.
Declared In
TCHConversationsClient.h
– conversationsClient:conversationAdded:
	Called when the current user has a conversation added to their conversation list.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversationAdded:(nonnull TCHConversation *)conversationParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
Discussion
Called when the current user has a conversation added to their conversation list.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:updated:
	Called when one of the current user’s conversations is changed.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation updated:(TCHConversationUpdate)updatedParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| updated | An indication of what changed on the conversation. | 
Discussion
Called when one of the current user’s conversations is changed.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:synchronizationStatusUpdated:
	Called when the conversation synchronization state is changed.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation synchronizationStatusUpdated:(TCHConversationSynchronizationStatus)statusParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| status | The current synchronization status of the conversation. | 
Discussion
Called when the conversation synchronization state is changed.
Declared In
TCHConversationsClient.h
– conversationsClient:conversationDeleted:
	Called when current participant is removed from the conversation or conversation is closed or deleted.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversationDeleted:(nonnull TCHConversation *)conversationParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
Discussion
Called when current participant is removed from the conversation or conversation is closed or deleted.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:participantJoined:
	Called when a conversation has a new participant join.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation participantJoined:(nonnull TCHParticipant *)participantParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| participant | The participant. | 
Discussion
Called when a conversation has a new participant join.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:participant:updated:
	Called when participant data is modified.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation participant:(nonnull TCHParticipant *)participant updated:(TCHParticipantUpdate)updatedParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| participant | The participant. | 
| updated | An indication of what changed on the participant. | 
Discussion
Called when participant data is modified.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:participantLeft:
	Called when a participant has left the conversation.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation participantLeft:(nonnull TCHParticipant *)participantParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| participant | The participant. | 
Discussion
Called when a participant has left the conversation.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:messageAdded:
	Called when a conversation receives a new message.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation messageAdded:(nonnull TCHMessage *)messageParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| message | The message. | 
Discussion
Called when a conversation receives a new message.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:message:updated:
	Called when message data is modified.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation message:(nonnull TCHMessage *)message updated:(TCHMessageUpdate)updatedParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| message | The message. | 
| updated | An indication of what changed on the message. | 
Discussion
Called when message data is modified.
Declared In
TCHConversationsClient.h
– conversationsClient:conversation:messageDeleted:
	Called when message is deleted from the conversation.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client conversation:(nonnull TCHConversation *)conversation messageDeleted:(nonnull TCHMessage *)messageParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| message | The message. | 
Discussion
Called when message is deleted from the conversation.
Declared In
TCHConversationsClient.h
– conversationsClient:errorReceived:
	Called when an error occurs.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client errorReceived:(nonnull TCHError *)errorParameters
| client | The conversations client. | 
|---|---|
| error | The error. | 
Discussion
Called when an error occurs.
Declared In
TCHConversationsClient.h
– conversationsClient:typingStartedOnConversation:participant:
	Called when a participant of a conversation starts typing.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client typingStartedOnConversation:(nonnull TCHConversation *)conversation participant:(nonnull TCHParticipant *)participantParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| participant | The participant. | 
Discussion
Called when a participant of a conversation starts typing.
Declared In
TCHConversationsClient.h
– conversationsClient:typingEndedOnConversation:participant:
	Called when a participant of a conversation ends typing.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client typingEndedOnConversation:(nonnull TCHConversation *)conversation participant:(nonnull TCHParticipant *)participantParameters
| client | The conversations client. | 
|---|---|
| conversation | The conversation. | 
| participant | The participant. | 
Discussion
Called when a participant of a conversation ends typing.
Declared In
TCHConversationsClient.h
– conversationsClient:notificationNewMessageReceivedForConversationSid:messageIndex:
	Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for a new message received notification.  handleNotification: parses the push payload and extracts the new message’s conversation and index for the push notification then calls this delegate method.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client notificationNewMessageReceivedForConversationSid:(nonnull NSString *)conversationSid messageIndex:(NSUInteger)messageIndexParameters
| client | The conversations client. | 
|---|---|
| conversationSid | The conversation sid for the new message. | 
| messageIndex | The index of the new message. | 
Discussion
Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for a new message received notification.  handleNotification: parses the push payload and extracts the new message’s conversation and index for the push notification then calls this delegate method.
Declared In
TCHConversationsClient.h
– conversationsClient:notificationAddedToConversationWithSid:
	Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for an added to conversation notification.  handleNotification: parses the push payload and extracts the conversation for the push notification then calls this delegate method.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client notificationAddedToConversationWithSid:(nonnull NSString *)conversationSidParameters
| client | The conversations client. | 
|---|---|
| conversationSid | The conversation sid for the newly added conversation. | 
Discussion
Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for an added to conversation notification.  handleNotification: parses the push payload and extracts the conversation for the push notification then calls this delegate method.
Declared In
TCHConversationsClient.h
– conversationsClient:notificationRemovedFromConversationWithSid:
	Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for a removed from conversation notification.  handleNotification: parses the push payload and extracts the conversation for the push notification then calls this delegate method.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client notificationRemovedFromConversationWithSid:(nonnull NSString *)conversationSidParameters
| client | The conversations client. | 
|---|---|
| conversationSid | The conversation sid for the removed conversation. | 
Discussion
Called as a result of TwilioConversationsClient’s handleNotification: method being invoked for a removed from conversation notification.  handleNotification: parses the push payload and extracts the conversation for the push notification then calls this delegate method.
Declared In
TCHConversationsClient.h
– conversationsClient:notificationUpdatedBadgeCount:
	Called when a processed push notification has changed the application’s badge count. You should call:
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client notificationUpdatedBadgeCount:(NSUInteger)badgeCountParameters
| client | The conversations 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 conversations (2 participants only) that have unread messages. This does not reflect total unread message count or conversations with more than 2 participants.
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
TCHConversationsClient.h
– conversationsClient:user:updated:
	Called when the current user’s or that of any subscribed conversation participant’s user is updated.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client user:(nonnull TCHUser *)user updated:(TCHUserUpdate)updatedParameters
| client | The conversations 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 conversation participant’s user is updated.
Declared In
TCHConversationsClient.h
– conversationsClient:userSubscribed:
	Called when the client subscribes to updates for a given user.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client userSubscribed:(nonnull TCHUser *)userParameters
| client | The conversations client. | 
|---|---|
| user | The object for subscribed user. | 
Discussion
Called when the client subscribes to updates for a given user.
Declared In
TCHConversationsClient.h
– conversationsClient:userUnsubscribed:
	Called when the client unsubscribes from updates for a given user.
- (void)conversationsClient:(nonnull TwilioConversationsClient *)client userUnsubscribed:(nonnull TCHUser *)userParameters
| client | The conversations client. | 
|---|---|
| user | The object for unsubscribed user. | 
Discussion
Called when the client unsubscribes from updates for a given user.
Declared In
TCHConversationsClient.h