VIMessenger
Interface that provides API to control messaging functions.
Methods
addDelegate:
- (void
)addDelegate:()delegate
Adds a delegate to handle messenger events.
Parameters
delegate:
Instance to be added as delegate
Returns
type:
void
createConversation:completion:
- (void
)createConversation:()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:
- Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
- 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
conversationConfig:
Config instance with extended conversation parameters
completion:
nullable VIMessengerCompletion<VIConversationEvent *> *
Completion handler to get the result or nil
Returns
type:
void
editUserWithCustomData:privateCustomData:completion:
- (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:
- Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
- 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:
- (void
)getConversation:(NSString *
)uuid
completion:(nullable VIMessengerCompletion<VIConversationEvent *> *
)completion
Gets a conversation by its UUID.
It is possible if:
- the user that calls the method is/has been a participant of this conversation
- the conversation is an available public conversation, see [VIMessenger getPublicConversations:]
To get the method call result use one of the following options:
- Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
- Implement the [VIMessengerDelegate messenger:didGetConversation:] and [VIMessengerDelegate messenger:didReceiveError:] events.
Only the client that called the method can be informed about getting conversation.
Parameters
uuid:
NSString *
Conversation UUID
completion:
nullable VIMessengerCompletion<VIConversationEvent *> *
Completion handler to get the result or nil
Returns
type:
void
getConversations:completion:
- (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:
- the user that calls the method is/has been a participant of these conversations
- the conversations are the available public conversations, see [VIMessenger getPublicConversations:]
To get the method call result use one of the following options:
- 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.
- 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:
- (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:
- Specify the completion parameter to consume the results with VIConversationListEvent or VIErrorEvent in case of success/error accordingly.
- 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
completion:
nullable VIMessengerCompletion<VIConversationListEvent *> *
Completion handler to get the result or nil
Returns
type:
void
getSubscriptionList:
- (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:
- Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
- Implement the [VIMessengerDelegate messenger:didGetSubscriptionList:] and [VIMessengerDelegate messenger:didReceiveError:] events.
Only the client that called the method can be informed about getting subscriptions.
Parameters
completion:
nullable VIMessengerCompletion<VISubscriptionEvent *> *
Completion handler to get the result or nil
Returns
type:
void
getUserByIMId:completion:
- (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:
- Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
- 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
imId:
NSNumber *
IM User id
completion:
nullable VIMessengerCompletion<VIUserEvent *> *
Completion handler to get the result or nil
Returns
type:
void
getUserByName:completion:
- (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:
- Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
- 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
username:
NSString *
Voximplant user identifier
completion:
nullable VIMessengerCompletion<VIUserEvent *> *
Completion handler to get the result or nil
Returns
type:
void
getUsersByIMId:completion:
- (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:
- 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.
- 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
imIds:
NSArray<NSNumber *> *
Array of IM user ids
completion:
nullable VIMessengerCompletion<NSArray<VIUserEvent *> *> *
Completion handler to get the result or nil
Returns
type:
void
getUsersByName:completion:
- (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:
- 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.
- 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:
- (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:
- a conversation is created by a user of the main Voximplant developer account or its child accounts
- public join is enabled ([VIConversation publicJoin] is YES)
- the conversation is not a direct one ([VIConversation direct] is NO)
To get the method call result use one of the following options:
- Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
- 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
uuid:
NSString *
Conversation UUID
completion:
nullable VIMessengerCompletion<VIConversationEvent *> *
Completion handler to get the result or nil
Returns
type:
void
leaveConversation:completion:
- (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:
- Specify the completion parameter to consume the results with VIConversationEvent or VIErrorEvent in case of success/error accordingly.
- 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
uuid:
NSString *
Conversation UUID
completion:
nullable VIMessengerCompletion<VIConversationEvent *> *
Completion handler to get the result or nil
Returns
type:
void
managePushNotifications:completion:
- (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:
- Specify the completion parameter to consume the results with VIUserEvent or VIErrorEvent in case of success/error accordingly.
- 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
notifications:
nullable NSArray<VIMessengerNotification> *
Array of VIMessengerNotification
completion:
nullable VIMessengerCompletion<VIUserEvent *> *
Completion handler to get the result or nil
Returns
type:
void
recreateConversation:uuid:lastSequence:lastUpdateTime:createdTime:
- (nullable VIConversation *
)recreateConversation:()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
config:
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
type:
nullable VIConversation *
recreateMessage:conversation:text:payload:sequence:
- (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
type:
nullable VIMessage *
removeDelegate:
- (void
)removeDelegate:()delegate
Removes the previously added delegate.
Parameters
delegate:
Delegate to be removed
Returns
type:
void
setStatus:completion:
- (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:
- Specify the completion parameter to consume the results with VIStatusEvent or VIErrorEvent in case of success/error accordingly.
- 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
online:
BOOL
Whether the user is available for messaging
completion:
nullable VIMessengerCompletion<VIStatusEvent *> *
Completion handler to get the result or nil
Returns
type:
void
subscribe:completion:
- (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:
- Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
- 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
users:
NSArray<NSNumber *> *
Array of IM user ids
completion:
nullable VIMessengerCompletion<VISubscriptionEvent *> *
Completion handler to get the result or nil
Returns
type:
void
unsubscribe:completion:
- (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:
- Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
- 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
users:
NSArray<NSNumber *> *
Array of IM user ids
completion:
nullable VIMessengerCompletion<VISubscriptionEvent *> *
Completion handler to get the result or nil
Returns
type:
void
unsubscribeFromAll:
- (void
)unsubscribeFromAll:(nullable VIMessengerCompletion<VISubscriptionEvent *> *
)completion
Unsubscribes from all subscriptions.
To get the method call result use one of the following options:
- Specify the completion parameter to consume the results with VISubscriptionEvent or VIErrorEvent in case of success/error accordingly.
- 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
completion:
nullable VIMessengerCompletion<VISubscriptionEvent *> *
Completion handler to get the result or nil
Returns
type:
void
Props
me
@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 *