Rate this page:

VIMessenger

Interface that provides API to control messaging functions.

Methods

addDelegate:

Copy URL
- (

void

)addDelegate:(

id<VIMessengerDelegate>

)delegate

Adds a delegate to handle messenger events.

Parameters

Returns

  • type:

    void

createConversation:completion:

Copy URL
- (

void

)createConversation:(

VIConversationConfig *

)conversationConfig
completion:(

nullable VIMessengerCompletion<VIConversationEvent *> *

)completion

Creates a new conversation with the extended configuration.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didCreateConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other parties of the conversation (online participants and logged in clients) can be informed about the conversation creation via the [VIMessengerDelegate messenger:didCreateConversation:] event.

Parameters

Returns

  • type:

    void

editUserWithCustomData:privateCustomData:completion:

Copy URL
- (

void

)editUserWithCustomData:(

nullable NSDictionary *

)customData
privateCustomData:(

nullable NSDictionary *

)privateCustomData
completion:(

nullable VIMessengerCompletion<VIUserEvent *> *

)completion

Edits the current user information.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didEditUser:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other users that are subscribed to the user can be informed about the editing via the [VIMessengerDelegate messenger:didEditUser:] event.

Parameters

  • customData:

    nullable NSDictionary *

    New custom data. If nil, previously set custom data is not changed. If empty dictionary, previously set custom data is removed

  • privateCustomData:

    nullable NSDictionary *

    New private custom data. If nil, previously set private custom data is not changed. If empty dictionary, previously set private custom data is removed

  • completion:

    nullable VIMessengerCompletion<VIUserEvent *> *

    Completion handler to get the result or nil

Returns

  • type:

    void

getConversation:completion:

Copy URL
- (

void

)getConversation:(

NSString *

)uuid
completion:(

nullable VIMessengerCompletion<VIConversationEvent *> *

)completion

Gets a conversation by its UUID.

It is possible if:

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didGetConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Only the client that called the method can be informed about getting conversation.

Parameters

Returns

  • type:

    void

getConversations:completion:

Copy URL
- (

void

)getConversations:(

NSArray<NSString *> *

)uuids
completion:(

nullable VIMessengerCompletion<NSArray<VIConversationEvent *> *> *

)completion

Gets the multiple conversations by the array of UUIDs. Maximum 30 conversations.

It is possible if:

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly. The result is an array with as many conversations events as the specified number of conversations UUIDs is.
  2. Implement the [VIMessengerDelegate messenger:didGetConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events. The event with a result is invoked as many times as the specified number of conversations UUIDs is; the error event is called once only.

Only the client that called the method can be informed about getting conversations.

Parameters

  • uuids:

    NSArray<NSString *> *

    Array of conversation UUIDs. Maximum 30 conversations

  • completion:

    nullable VIMessengerCompletion<NSArray<VIConversationEvent *> *> *

    Completion handler to get the result or nil

Returns

  • type:

    void

getPublicConversations:

Copy URL
- (

void

)getPublicConversations:(

nullable VIMessengerCompletion<VIConversationListEvent *> *

)completion

Gets all public conversations ([VIConversation publicJoin] is YES).

It is possible to get all public conversations (UUIDs) that have been created by:

  • the current user
  • other users of the same child account
  • users of the main Voximplant developer account

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationListEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didGetPublicConversations:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Only the client that called the method can be informed about getting public conversations UUIDs.

Parameters

Returns

  • type:

    void

getSubscriptionList:

Copy URL
- (

void

)getSubscriptionList:(

nullable VIMessengerCompletion<VISubscriptionEvent *> *

)completion

Gets all current subscriptions, i.e., the array of users the current user is subscribed to.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didGetSubscriptionList:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Only the client that called the method can be informed about getting subscriptions.

Parameters

Returns

  • type:

    void

getUserByIMId:completion:

Copy URL
- (

void

)getUserByIMId:(

NSNumber *

)imId
completion:(

nullable VIMessengerCompletion<VIUserEvent *> *

)completion

Gets information for the user specified by the IM user ID.

It is possible to get any user of the main Voximplant developer account or its child accounts.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didGetUser:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Only the client that called the method can be informed about getting user information.

Parameters

Returns

  • type:

    void

getUserByName:completion:

Copy URL
- (

void

)getUserByName:(

NSString *

)username
completion:(

nullable VIMessengerCompletion<VIUserEvent *> *

)completion

Gets information for the user specified by the Voximplant user name, e.g., 'username@appname.accname'.

It is possible to get any user of the main Voximplant developer account or its child accounts.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didGetUser:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Only the client that called the method can be informed about getting user information.

Parameters

Returns

  • type:

    void

getUsersByIMId:completion:

Copy URL
- (

void

)getUsersByIMId:(

NSArray<NSNumber *> *

)imIds
completion:(

nullable VIMessengerCompletion<NSArray<VIUserEvent *> *> *

)completion

Gets information for the users specified by the array of the IM user ids. Maximum 50 users.

It is possible to get any users of the main Voximplant developer account or its child accounts.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly. The result is an array with as many user events as the specified number of IM user IDs is.
  2. Implement the [VIMessengerDelegate messenger:didGetUser:] and [VIMessengerDelegate messenger:didReceiveError:] events. The event with a result is invoked as many times as the specified number of IM user ids is; the error event is called once only.

Only the client that called the method can be informed about getting users information.

Parameters

Returns

  • type:

    void

getUsersByName:completion:

Copy URL
- (

void

)getUsersByName:(

NSArray<NSString *> *

)users
completion:(

nullable VIMessengerCompletion<NSArray<VIUserEvent *> *> *

)completion

Gets information for the users specified by the array of the Voximplant user names. Maximum 50 users.

It is possible to get any users of the main Voximplant developer account or its child accounts.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly. The result is an array with as many user events as the specified number of user names is.
  2. Implement the [VIMessengerDelegate messenger:didGetUser:] and [VIMessengerDelegate messenger:didReceiveError:] events. The event with a result is invoked as many times as the specified number of user names is; the error event is called once only.

Only the client that called the method can be informed about getting users information.

Parameters

  • users:

    NSArray<NSString *> *

    Array of Voximplant user identifiers, e.g., 'username@appname.accname'

  • completion:

    nullable VIMessengerCompletion<NSArray<VIUserEvent *> *> *

    Completion handler to get the result or nil

Returns

  • type:

    void

joinConversation:completion:

Copy URL
- (

void

)joinConversation:(

NSString *

)uuid
completion:(

nullable VIMessengerCompletion<VIConversationEvent *> *

)completion

Joins the current user to any conversation specified by the UUID.

It is possible only on the following conditions:

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didEditConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other parties of the conversation (online participants and logged in clients) can be informed about joining to the conversation via the [VIMessengerDelegate messenger:didEditConversation:] event.

Parameters

Returns

  • type:

    void

leaveConversation:completion:

Copy URL
- (

void

)leaveConversation:(

NSString *

)uuid
completion:(

nullable VIMessengerCompletion<VIConversationEvent *> *

)completion

Makes the current user to leave a conversation specified by the UUID.

It is possible only if the conversation is not a direct one ([VIConversation direct] is NO)

After a successful method call the conversation's UUID is added to [VIUser leaveConversationList].

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didEditConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other parties of the conversation (online participants and logged in clients) can be informed about leaving the conversation via the [VIMessengerDelegate messenger:didEditConversation:] event.

Parameters

Returns

  • type:

    void

managePushNotifications:completion:

Copy URL
- (

void

)managePushNotifications:(

nullable NSArray<VIMessengerNotification> *

)notifications
completion:(

nullable VIMessengerCompletion<VIUserEvent *> *

)completion

Manages messenger push notification subscriptions for the current user.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didEditUser:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other logged in clients (of the current user) can be informed about managing push notifications via [VIMessengerDelegate messenger:didEditUser:].

Parameters

Returns

  • type:

    void

recreateConversation:uuid:lastSequence:lastUpdateTime:createdTime:

Copy URL
- (

nullable VIConversation *

)recreateConversation:(

VIConversationConfig *

)config
uuid:(

NSString *

)uuid
lastSequence:(

SInt64

)lastSequence
lastUpdateTime:(

NSTimeInterval

)lastUpdateTime
createdTime:(

NSTimeInterval

)createdTime

Recreates a conversation.

Note that this method does not create a conversation, but restore a previously created conversation from a local storage (database).

Parameters

  • Conversation config

  • uuid:

    NSString *

    Conversation UUID

  • lastSequence:

    SInt64

    Sequence of the last event stored in a local storage (database)

  • lastUpdateTime:

    NSTimeInterval

    UNIX timestamp that specifies the time of the last event stored in a local storage (database)

  • createdTime:

    NSTimeInterval

    UNIX timestamp that specifies the time of the conversation creation

Returns

recreateMessage:conversation:text:payload:sequence:

Copy URL
- (

nullable VIMessage *

)recreateMessage:(

NSString *

)uuid
conversation:(

NSString *

)conversationUUID
text:(

nullable NSString *

)text
payload:(

nullable NSArray<NSDictionary<NSString *, NSObject *> *> *

)payload
sequence:(

SInt64

)sequence

Recreates a message.

Note that this method does not create a message, but restore a previously created message from a local storage (database).

Parameters

  • uuid:

    NSString *

    Universally unique identifier of message

  • conversationUUID:

    NSString *

    UUID of the conversation this message belongs to

  • text:

    nullable NSString *

    Text of this message

  • payload:

    nullable NSArray<NSDictionary<NSString *, NSObject *> *> *

    Array of payload objects associated with the message

  • sequence:

    SInt64

    Message sequence number

Returns

removeDelegate:

Copy URL
- (

void

)removeDelegate:(

id<VIMessengerDelegate>

)delegate

Removes the previously added delegate.

Parameters

Returns

  • type:

    void

setStatus:completion:

Copy URL
- (

void

)setStatus:(

BOOL

)online
completion:(

nullable VIMessengerCompletion<VIStatusEvent *> *

)completion

Sets the current user status.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VIStatusEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didSetStatus:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other users (that are subscribed to the user) and other clients (of the current user) can be informed about the status changing via the [VIMessengerDelegate messenger:didSetStatus:] event.

Parameters

Returns

  • type:

    void

subscribe:completion:

Copy URL
- (

void

)subscribe:(

NSArray<NSNumber *> *

)users
completion:(

nullable VIMessengerCompletion<VISubscriptionEvent *> *

)completion

Subscribes to other user(s) information and status changes.

It is possible to subscribe for any user of the main Voximplant developer account or its child accounts.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didSubscribe:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other logged in clients (of the current user) can be informed about the subscription via the [VIMessengerDelegate messenger:didSubscribe:] event. User(s) specified in the 'users' parameter are not informed about the subscription.

Parameters

Returns

  • type:

    void

unsubscribe:completion:

Copy URL
- (

void

)unsubscribe:(

NSArray<NSNumber *> *

)users
completion:(

nullable VIMessengerCompletion<VISubscriptionEvent *> *

)completion

Unsubscribes from other user(s) information and status changes.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didUnsubscribe:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other logged in clients (of the current user) can be informed about the unsubscription via the [VIMessengerDelegate messenger:didUnsubscribe:] event. User(s) specified in the 'users' parameter are not informed about the unsubscription.

Parameters

Returns

  • type:

    void

unsubscribeFromAll:

Copy URL
- (

void

)unsubscribeFromAll:(

nullable VIMessengerCompletion<VISubscriptionEvent *> *

)completion

Unsubscribes from all subscriptions.

To get the method call result use one of the following options:

  1. Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
  2. Implement the [VIMessengerDelegate messenger:didUnsubscribe:] and [VIMessengerDelegate messenger:didReceiveError:] events.

Other logged in clients (of the current user) can be informed about the unsubscription via the [VIMessengerDelegate messenger:didUnsubscribe:] event. Other users are not informed about the unsubscription.

Parameters

Returns

  • type:

    void

Props

me

Copy URL
@property (strong, nullable, readonly, nonatomic) 

NSString *

me

Voximplant user identifier for the current user (e.g., 'username@appname.accname'), or nil if the client is not logged in.

Returns

  • type:

    NSString *