TCHChannel Class Reference
Inherits from | NSObject |
---|---|
Declared in | TCHChannel.h |
delegate
Optional channel delegate. Upon setting the delegate, you will receive the current channel synchronization status by delegate method.
@property (nonatomic, weak, nullable) id<TCHChannelDelegate> delegate
Discussion
Optional channel delegate. Upon setting the delegate, you will receive the current channel synchronization status by delegate method.
Declared In
TCHChannel.h
sid
The unique identifier for this channel.
@property (nonatomic, copy, readonly, nullable) NSString *sid
Discussion
The unique identifier for this channel.
Declared In
TCHChannel.h
friendlyName
The friendly name for this channel.
@property (nonatomic, copy, readonly, nullable) NSString *friendlyName
Discussion
The friendly name for this channel.
Declared In
TCHChannel.h
uniqueName
The unique name for this channel.
@property (nonatomic, copy, readonly, nullable) NSString *uniqueName
Discussion
The unique name for this channel.
Declared In
TCHChannel.h
messages
The messages list object for this channel.
@property (nonatomic, strong, readonly, nullable) TCHMessages *messages
Discussion
The messages list object for this channel.
Declared In
TCHChannel.h
members
The members list object for this channel.
@property (nonatomic, strong, readonly, nullable) TCHMembers *members
Discussion
The members list object for this channel.
Declared In
TCHChannel.h
status
The current user’s status on this channel.
@property (nonatomic, assign, readonly) TCHChannelStatus status
Discussion
The current user’s status on this channel.
Declared In
TCHChannel.h
notificationLevel
The current user’s notification level on this channel. This property reflects whether the user will receive push notifications for activity on this channel.
@property (nonatomic, assign, readonly) TCHChannelNotificationLevel notificationLevel
Discussion
The current user’s notification level on this channel. This property reflects whether the user will receive push notifications for activity on this channel.
Declared In
TCHChannel.h
type
The channel’s visibility type.
@property (nonatomic, assign, readonly) TCHChannelType type
Discussion
The channel’s visibility type.
Declared In
TCHChannel.h
dateCreated
The channel creation date.
@property (nonatomic, strong, readonly, nullable) NSString *dateCreated
Discussion
The channel creation date.
Declared In
TCHChannel.h
dateCreatedAsDate
The channel creation date as an NSDate.
@property (nonatomic, strong, readonly, nullable) NSDate *dateCreatedAsDate
Discussion
The channel creation date as an NSDate.
Declared In
TCHChannel.h
createdBy
The identity of the channel’s creator.
@property (nonatomic, copy, readonly, nullable) NSString *createdBy
Discussion
The identity of the channel’s creator.
Declared In
TCHChannel.h
dateUpdated
The timestamp the channel was last updated.
@property (nonatomic, strong, readonly, nullable) NSString *dateUpdated
Discussion
The timestamp the channel was last updated.
Declared In
TCHChannel.h
dateUpdatedAsDate
The timestamp the channel was last updated as an NSDate.
@property (nonatomic, strong, readonly, nullable) NSDate *dateUpdatedAsDate
Discussion
The timestamp the channel was last updated as an NSDate.
Declared In
TCHChannel.h
lastMessageDate
The timestamp of the channel’s most recent message.
@property (nonatomic, strong, readonly, nullable) NSDate *lastMessageDate
Discussion
The timestamp of the channel’s most recent message.
Declared In
TCHChannel.h
lastMessageIndex
The index of the channel’s most recent message.
@property (nonatomic, strong, readonly, nullable) NSNumber *lastMessageIndex
Discussion
The index of the channel’s most recent message.
Declared In
TCHChannel.h
– attributes
Return this channel’s attributes.
- (nullable TCHJsonAttributes *)attributes
Return Value
The developer-defined extensible attributes for this channel.
Discussion
Return this channel’s attributes.
Declared In
TCHChannel.h
– setAttributes:completion:
Set this channel’s attributes.
- (void)setAttributes:(nullable TCHJsonAttributes *)attributes completion:(nullable TCHCompletion)completion
Parameters
attributes |
The new developer-defined extensible attributes for this channel. (Supported types are NSString, NSNumber, NSArray, NSDictionary and NSNull) |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Set this channel’s attributes.
Declared In
TCHChannel.h
– setFriendlyName:completion:
Set this channel’s friendly name.
- (void)setFriendlyName:(nullable NSString *)friendlyName completion:(nullable TCHCompletion)completion
Parameters
friendlyName |
The new friendly name for this channel. |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Set this channel’s friendly name.
Declared In
TCHChannel.h
– setUniqueName:completion:
Set this channel’s unique name.
- (void)setUniqueName:(nullable NSString *)uniqueName completion:(nullable TCHCompletion)completion
Parameters
uniqueName |
The new unique name for this channel. |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Set this channel’s unique name.
Declared In
TCHChannel.h
– setNotificationLevel:completion:
Set the user’s notification level for the channel. This property determines whether the user will receive push notifications for activity on this channel.
- (void)setNotificationLevel:(TCHChannelNotificationLevel)notificationLevel completion:(nullable TCHCompletion)completion
Parameters
notificationLevel |
The new notification level for the current user on this channel. |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Set the user’s notification level for the channel. This property determines whether the user will receive push notifications for activity on this channel.
Declared In
TCHChannel.h
– joinWithCompletion:
Join the current user to this channel.
- (void)joinWithCompletion:(nullable TCHCompletion)completion
Parameters
completion |
Completion block that will specify the result of the operation. |
---|
Discussion
Join the current user to this channel.
Declared In
TCHChannel.h
– declineInvitationWithCompletion:
Decline an invitation to this channel.
- (void)declineInvitationWithCompletion:(nullable TCHCompletion)completion
Parameters
completion |
Completion block that will specify the result of the operation. |
---|
Discussion
Decline an invitation to this channel.
Declared In
TCHChannel.h
– leaveWithCompletion:
Leave the current channel.
- (void)leaveWithCompletion:(nullable TCHCompletion)completion
Parameters
completion |
Completion block that will specify the result of the operation. |
---|
Discussion
Leave the current channel.
Declared In
TCHChannel.h
– destroyWithCompletion:
Destroy the current channel, removing all of its members.
- (void)destroyWithCompletion:(nullable TCHCompletion)completion
Parameters
completion |
Completion block that will specify the result of the operation. |
---|
Discussion
Destroy the current channel, removing all of its members.
Declared In
TCHChannel.h
– typing
Indicates to other users and the backend that the user is typing a message to this channel.
- (void)typing
Discussion
Indicates to other users and the backend that the user is typing a message to this channel.
Declared In
TCHChannel.h
– memberWithIdentity:
Fetch the member object for the given identity if it exists.
- (nullable TCHMember *)memberWithIdentity:(nonnull NSString *)identity
Parameters
identity |
The username to fetch. |
---|
Return Value
The TCHMember object, if one exists for the username for this channel.
Discussion
Fetch the member object for the given identity if it exists.
Declared In
TCHChannel.h
– getUnconsumedMessagesCountWithCompletion:
Fetch the number of unconsumed messages on this channel for the current user.
- (void)getUnconsumedMessagesCountWithCompletion:(nonnull TCHNullableCountCompletion)completion
Parameters
completion |
Completion block that will specify the requested count. If no completion block is specified, no operation will be executed. |
---|
Discussion
Fetch the number of unconsumed messages on this channel for the current user.
Use this method to obtain number of unread messages together with [TCHMessages setLastConsumedMessageIndex:completion:] instead of relying on TCHMessage indices which may have gaps. See [TCHMessage index] for details.
Available even if the channel is not yet synchronized.
Note: if the last consumed index has not been yet set for current user as the member of this channel then unconsumed messages count is considered uninitialized. In this case nil is returned. See [TCHMessages setLastConsumedMessageIndex:completion:] and https://www.twilio.com/docs/chat/consumption-horizon for more info.
This method is semi-realtime. This means that this data will be eventually correct, but will also possibly be incorrect for a few seconds. The Chat system does not provide real time events for counter values changes.
So this is quite useful for any “unread messages count” badges, but is not recommended to build any core application logic based on these counters being accurate in real time. This function performs an async call to service to obtain up-to-date message count.
The retrieved value is then cached for 5 seconds so there is no reason to call this function more often than once in 5 seconds.
Declared In
TCHChannel.h
– getMessagesCountWithCompletion:
Fetch the number of messages on this channel.
- (void)getMessagesCountWithCompletion:(nonnull TCHCountCompletion)completion
Parameters
completion |
Completion block that will specify the requested count. If no completion block is specified, no operation will be executed. |
---|
Discussion
Fetch the number of messages on this channel.
Available even if the channel is not yet synchronized.
This method is semi-realtime. This means that this data will be eventually correct, but will also possibly be incorrect for a few seconds. The Chat system does not provide real time events for counter values changes.
So this is quite useful for any UI badges, but is not recommended to build any core application logic based on these counters being accurate in real time. This function performs an async call to service to obtain up-to-date message count.
The retrieved value is then cached for 5 seconds so there is no reason to call this function more often than once in 5 seconds.
Declared In
TCHChannel.h
– getMembersCountWithCompletion:
Fetch the number of members on this channel.
- (void)getMembersCountWithCompletion:(nonnull TCHCountCompletion)completion
Parameters
completion |
Completion block that will specify the requested count. If no completion block is specified, no operation will be executed. |
---|
Discussion
Fetch the number of members on this channel.
Available even if the channel is not yet synchronized.
This method is semi-realtime. This means that this data will be eventually correct, but will also possibly be incorrect for a few seconds. The Chat system does not provide real time events for counter values changes.
So this is quite useful for any UI badges, but is not recommended to build any core application logic based on these counters being accurate in real time. This function performs an async call to service to obtain up-to-date message count.
The retrieved value is then cached for 5 seconds so there is no reason to call this function more often than once in 5 seconds.
Declared In
TCHChannel.h