channelId, which is any string that uniquely identifies the channel and is immutable through its lifetime. When creating channels, you can specify your own
channelId, or leave it to Amity's Chat SDK to automatically generate one for you.
channelId: an error will be thrown when trying to generate two channels with the same
createChannel:guarantees that the requested channel is a new channel, whereas
joinChannel:will attempt to join an existing channel. If there is a requirement to create a new channel, then use of
joinChannel:. Lastly calling
getChannel:only gives you back the channel LiveObject, but it won't make the current user join said channel.
ChannelRepositoryclass. Before being able to call any channel method, you must initialize a repository instance using the
ASCClientinstance you created on setup:
createChannel()method to create a new channel. It supports creating of 3 types of channels
Conversation. Each channel type has specific builder classes which helps you to create that particular channel. Build your channel information first and then create the particular channel.
ChannelRepository, a class that contain all channel related methods. Then it calls
createChannel:to obtain the LiveObject and observe it in order to obtain the final channel model.
NotificationTokenreturned by the
observe:is saved in
self.channelToken, a strongly referenced property. This is needed in order to prevent the observe block to be released. Observe block can get called multiple time, when the underlying data for the channel updates. If you don't want to get notified, you can call
channelToken.invalidate(). As soon as the token gets invalidated, observer is automatically removed from that channel.
channelID, the LiveObject will notify you with an
nil: when this happens, the SDK will generate an unique
channelIdfor this channel, ensuring no unique ID conflicts.
Conversation. Creation of
Standardtype has been removed. Creation of
Broadcastchannel type is not supported through the SDK. But for query,
channelCollection:method supports all channel types including
joinChannel:is an idempotent method, this means it can be called multiple times throughout the lifecycle of the application, and you can expect this method to always return the same channel. Because of this, you can also use
joinChannel:any time you need to fetch a channel, even if you know the user may already be in the channel.
getChannel:method can be used:
ChannelRepositoryprovides a way to query list of channels using
channelCollection()method. It returns a
LiveCollectionof all the matching channels available. This live collection returned will automatically update and notify you on any channel modifications.
channelsForFilter(_:includingTags:excludingTags:)method to query channels is now depreciated. SDK now doesnot support creation of Private & Standard channels but still supports query using
UICollectionViewto display channel list data, the ideal location to reload table data is directly in the observe block of the LiveObject that you are displaying, as shown in the example above.
metadataproperty on the channel model.
displayNameproperty. This property is mainly used to identify the channel in push notifications, but it is also exposed to the application via
displayNamewith the following method:
ChannelParticipationclass. Before calling any participation methods, you must ensure to first instantiate a repository instance using the
ASCClientinstance you created on setup and a valid
ChannelMembershipRepositoryinstance by the
membershipproperty of a channel LiveObject model:
ChannelRepositoryobject exposes an
totalUnreadCountproperty that reflects the number of messages that the current user has yet to read. This count is the sum of all the
unreadCountchannels properties where the user is already a member.
unreadCountto zero, the participation membership exposes the
stopReadingon the user behalf.
ChannelModerationclass provides various methods to moderate the users present in channel. You can ban/unban/mute users, assign roles or remove it from user.
hasPermission(permission:forChannel:_:)method from the