AVIMClient Class Reference

Inherits from NSObject
Declared in AVIMClient.h

Other Methods

+ setUnreadNotificationEnabled:

Set what server will issues for offline messages when client did login.

+ (void)setUnreadNotificationEnabled:(BOOL)enabled

Parameters

enabled

Set YES if you want server just issues the count of offline messages in each conversation. Set NO if you want server issues concrete offline messages. Defaults to NO.

Discussion

Set what server will issues for offline messages when client did login.

Declared In

AVIMClient.h

+ setTimeoutIntervalInSeconds:

设置实时通信的超时时间,默认 30 秒。

+ (void)setTimeoutIntervalInSeconds:(NSTimeInterval)seconds

Parameters

seconds

超时时间,单位是秒。

Discussion

设置实时通信的超时时间,默认 30 秒。

Declared In

AVIMClient.h

  delegate

No thread-safe for getter & setter. recommend setting after instantiation.

@property (nonatomic, weak, nullable) id<AVIMClientDelegate> delegate

Discussion

No thread-safe for getter & setter. recommend setting after instantiation.

Declared In

AVIMClient.h

  signatureDataSource

@property (nonatomic, weak, nullable) id<AVIMSignatureDataSource> signatureDataSource

  clientId

The ID of this Client.

@property (nonatomic, strong, readonly, nonnull) NSString *clientId

Discussion

The ID of this Client.

Declared In

AVIMClient.h

  user

The AVUser of this Client.

@property (nonatomic, strong, readonly, nullable) AVUser *user

Discussion

The AVUser of this Client.

Declared In

AVIMClient.h

  tag

The Tag of this Client.

@property (nonatomic, strong, readonly, nullable) NSString *tag

Discussion

The Tag of this Client.

Declared In

AVIMClient.h

  messageQueryCacheEnabled

控制是否打开历史消息查询本地缓存的功能, 默认开启

@property (nonatomic, assign) BOOL messageQueryCacheEnabled

Discussion

控制是否打开历史消息查询本地缓存的功能, 默认开启

Declared In

AVIMClient.h

+ new

+ (instancetype)new

– init

- (instancetype)init

– initWithClientId:

Initialization method.

- (instancetype)initWithClientId:(NSString *)clientId

Parameters

clientId

Identifie of this Client.

Return Value

Instance.

Discussion

Initialization method.

Note: clientId’s length should in range [1, 64].

Declared In

AVIMClient.h

– initWithClientId:tag:

Initialization method.

- (instancetype)initWithClientId:(NSString *)clientId tag:(NSString *_Nullable)tag

Parameters

clientId

Identifie of this Client.

tag

Set it to implement only one client online.

Return Value

Instance.

Discussion

Initialization method.

Note: clientId’s length should in range [1, 64], tag should not use @“default”.

Declared In

AVIMClient.h

– initWithUser:

Initialization method.

- (instancetype)initWithUser:(AVUser *)user

Parameters

user

The AVUser of this Client.

Return Value

Instance.

Discussion

Initialization method.

Declared In

AVIMClient.h

– initWithUser:tag:

Initialization method.

- (instancetype)initWithUser:(AVUser *)user tag:(NSString *_Nullable)tag

Parameters

user

The AVUser of this Client.

tag

Set it to implement only one client online.

Return Value

Instance.

Discussion

Initialization method.

Note: tag should not use @“default”.

Declared In

AVIMClient.h

– status

The Status of this Client.

- (AVIMClientStatus)status

Discussion

The Status of this Client.

Declared In

AVIMClient.h

– openWithCallback:

Start a Session with Server. It is similar to Login.

- (void)openWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

Result Callback.

Discussion

Start a Session with Server. It is similar to Login.

Declared In

AVIMClient.h

– openWithOption:callback:

Start a Session with Server. It is similar to Login.

- (void)openWithOption:(AVIMClientOpenOption)openOption callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

openOption

See more: AVIMClientOpenOption.

callback

Result Callback.

Discussion

Start a Session with Server. It is similar to Login.

Declared In

AVIMClient.h

– closeWithCallback:

End a Session with Server. It is similar to Logout.

- (void)closeWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

Result Callback.

Discussion

End a Session with Server. It is similar to Logout.

Declared In

AVIMClient.h

– createConversationWithName:clientIds:callback:

创建一个新的用户对话。 在单聊的场合,传入对方一个 clientId 即可;群聊的时候,支持同时传入多个 clientId 列表

- (void)createConversationWithName:(NSString *_Nullable)name clientIds:(NSArray<NSString*> *)clientIds callback:(void ( ^ ) ( AVIMConversation *_Nullable conversation , NSError *_Nullable error ))callback

Parameters

name
  • 会话名称。
clientIds
  • 聊天参与者(发起人除外)的 clientId 列表。
callback

- 对话建立之后的回调

Discussion

创建一个新的用户对话。 在单聊的场合,传入对方一个 clientId 即可;群聊的时候,支持同时传入多个 clientId 列表

Declared In

AVIMClient.h

– createChatRoomWithName:attributes:callback:

Create a new chat room conversation.

- (void)createChatRoomWithName:(NSString *_Nullable)name attributes:(NSDictionary *_Nullable)attributes callback:(void ( ^ ) ( AVIMChatRoom *_Nullable chatRoom , NSError *_Nullable error ))callback

Parameters

name

Name of the chat room.

attributes

Custom attributes of the chat room.

callback

Result of callback.

Discussion

Create a new chat room conversation.

Declared In

AVIMClient.h

– createTemporaryConversationWithClientIds:timeToLive:callback:

Create a new temporary conversation.

- (void)createTemporaryConversationWithClientIds:(NSArray<NSString*> *)clientIds timeToLive:(int32_t)ttl callback:(void ( ^ ) ( AVIMTemporaryConversation *_Nullable temporaryConversation , NSError *_Nullable error ))callback

Parameters

clientIds

Member’s client ID of conversation.

ttl

Use it to setup time to live of temporary conversation. it will not greater than a default max value(depend on server). if set Zero or Negtive, it will use max ttl, Unit of Measure: Second.

callback

Result of callback.

Discussion

Create a new temporary conversation.

Declared In

AVIMClient.h

– createConversationWithName:clientIds:attributes:options:callback:

创建一个新的用户对话。 在单聊的场合,传入对方一个 clientId 即可;群聊的时候,支持同时传入多个 clientId 列表

- (void)createConversationWithName:(NSString *_Nullable)name clientIds:(NSArray<NSString*> *)clientIds attributes:(NSDictionary *_Nullable)attributes options:(AVIMConversationOption)options callback:(void ( ^ ) ( AVIMConversation *_Nullable conversation , NSError *_Nullable error ))callback

Parameters

name
  • 会话名称。
clientIds
  • 聊天参与者(发起人除外)的 clientId 列表。
attributes
  • 会话的自定义属性。
options

- 可选参数,可以使用或 “|” 操作表示多个选项

callback

- 对话建立之后的回调

Discussion

创建一个新的用户对话。 在单聊的场合,传入对方一个 clientId 即可;群聊的时候,支持同时传入多个 clientId 列表

Declared In

AVIMClient.h

– createConversationWithName:clientIds:attributes:options:temporaryTTL:callback:

Create a New Conversation.

- (void)createConversationWithName:(NSString *_Nullable)name clientIds:(NSArray<NSString*> *)clientIds attributes:(NSDictionary *_Nullable)attributes options:(AVIMConversationOption)options temporaryTTL:(int32_t)temporaryTTL callback:(void ( ^ ) ( AVIMConversation *_Nullable conversation , NSError *_Nullable error ))callback

Parameters

name

Name of the Conversation.

clientIds

Array of Other Client’s ID

attributes

Custom Attributes

options

Option of the Conversation’s Type

temporaryTTL

Temporary Conversation’s Time to Live, Unit of Measure: Second.

callback

Result callback

Discussion

Create a New Conversation.

Declared In

AVIMClient.h

– conversationForId:

Get a Exist Conversation Retained by this Client. Thread-safe & Sync.

- (AVIMConversation *_Nullable)conversationForId:(NSString *)conversationId

Parameters

conversationId

conversationId

Return Value

if the Conversation Exist, return the Instance; if not, return nil.

Discussion

Get a Exist Conversation Retained by this Client. Thread-safe & Sync.

Declared In

AVIMClient.h

– getConversationsFromMemoryWith:callback:

Get Conversations Retained by this Client. Thread-safe & Async.

- (void)getConversationsFromMemoryWith:(NSArray<NSString*> *)conversationIds callback:(void ( ^ ) ( NSArray<AVIMConversation*> *_Nullable conversations ))callback

Parameters

conversationIds

ID array.

callback

Result.

Discussion

Get Conversations Retained by this Client. Thread-safe & Async.

Declared In

AVIMClient.h

– removeConversationsInMemoryWith:callback:

Remove Conversations Retained by this Client. Thread-safe & Async.

- (void)removeConversationsInMemoryWith:(NSArray<NSString*> *)conversationIds callback:(void ( ^ ) ( void ))callback

Parameters

conversationIds

Array of conversation’s ID

callback

Result of Callback, always means success.

Discussion

Remove Conversations Retained by this Client. Thread-safe & Async.

Declared In

AVIMClient.h

– removeAllConversationsInMemoryWith:

Remove all Conversations Retained by this Client. Thread-safe & Async.

- (void)removeAllConversationsInMemoryWith:(void ( ^ ) ( void ))callback

Parameters

callback

Result of Callback, always means success.

Discussion

Remove all Conversations Retained by this Client. Thread-safe & Async.

Declared In

AVIMClient.h

– conversationWithKeyedConversation:

创建一个绑定到当前 client 的会话。

- (AVIMConversation *_Nullable)conversationWithKeyedConversation:(AVIMKeyedConversation *)keyedConversation

Parameters

keyedConversation

AVIMKeyedConversation 对象。

Return Value

已绑定到当前 client 的会话。

Discussion

创建一个绑定到当前 client 的会话。

Declared In

AVIMClient.h

– conversationQuery

构造一个对话查询对象

- (AVIMConversationQuery *)conversationQuery

Return Value

对话查询对象.

Discussion

构造一个对话查询对象

Declared In

AVIMClient.h

– queryOnlineClientsInClients:callback:

Query online clients within the given array of clients.

- (void)queryOnlineClientsInClients:(NSArray<NSString*> *)clients callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable clientIds , NSError *_Nullable error ))callback

Parameters

clients

An array of clients you want to query.

callback

The callback of query.

Discussion

Query online clients within the given array of clients.

Note: Currently, It only supports to query 20 clients at most.

Declared In

AVIMClient.h

AVDeprecated Methods

+ setUserOptions:

设置用户选项。 该接口用于控制 AVIMClient 的一些细节行为。

+ (void)setUserOptions:(NSDictionary *)userOptions

Parameters

userOptions

用户选项。

Discussion

设置用户选项。 该接口用于控制 AVIMClient 的一些细节行为。

Declared In

AVIMClient.h