VIMessenger

Interface that may be used to control messaging functions.

Members
–  addDelegate:

Add VIMessengerDelegate to handle messenger events.

- (void)addDelegate:(id<VIMessengerDelegate>)delegate
Parameters
delegate

VIMessengerDelegate instance to be added

–  removeDelegate:

Remove previously added VIMessengerDelegate delegate

- (void)removeDelegate:(id<VIMessengerDelegate>)delegate
Parameters
delegate

VIMessengerDelegate delegate to be removed

–  createConversation:moderators:title:distinct:enablePublicJoin:customData:

Create new conversation. Triggers the [VIMessengerDelegate messenger:didCreateConversation:] event for all messenger objects on all connected clients that are mentioned in the ‘participants’ array.

- (void)createConversation:(NSArray<VIConversationParticipant*> *)participants moderators:(NSArray<NSString*> *)moderators title:(NSString *)title distinct:(BOOL)distinct enablePublicJoin:(BOOL)enablePublicJoin customData:(NSDictionary *)customData
Parameters
participants
moderators

Array of conversation moderators' names

title

Conversation title

distinct

Specify if conversation is distinct.

enablePublicJoin

If set to ‘true’, anyone can join conversation by uuid

customData

Dictionary with custom data, up to 5kb

–  leaveConversation:

Leave current user from the conversation specified by the UUID.

- (void)leaveConversation:(NSString *)uuid
Parameters
uuid

Conversation UUID

–  joinConversation:

Join current user to the conversation specified by the UUID.

- (void)joinConversation:(NSString *)uuid
Parameters
uuid

Conversation UUID

–  removeConversation:

Remove the conversation specified by the UUID.

- (void)removeConversation:(NSString *)uuid
Parameters
uuid

UUID of the conversation to be removed

–  getMe

Get the Voximplant user identifier, ex username@appname.accname, for the current user

- (NSString *)getMe
Return

Current user identifier

–  getUser:

Get user information for the user specified by the Voximplant user identifier, ex username@appname.accname.

- (void)getUser:(NSString *)user
Parameters
user

User identifier

–  getUsers:

Get user information for the users specified by the array of the Voximplant user identifiers, ex username@appname.accname.

- (void)getUsers:(NSArray<NSString*> *)users
Parameters
users

Array of user identifiers

–  editUserWithCustomData:privateCustomData:

Edit current user information.

- (void)editUserWithCustomData:(NSDictionary *)customData privateCustomData:(NSDictionary *)privateCustomData
Parameters
customData

New custom data. If nil, previously set custom data will not be changed. If empty map, previously set custom data will be removed.

privateCustomData

New private custom data. If nil, previously set private custom data will not be changed. If empty map, previously set private custom data will be removed.

–  subscribe:

Subscribe for user information change and presence status change. On change, the [VIMessengerDelegate messenger:didSetStatus:] event will be triggered.

- (void)subscribe:(NSArray<NSString*> *)users
Parameters
users

Array of Voximplant user identifiers, ex username@appname.accname

–  unsubscribe:

Unsubscribe for user information change and presence status change.

- (void)unsubscribe:(NSArray<NSString*> *)users
Parameters
users

Array of Voximplant user identifiers, ex username@appname.accname

–  getConversation:

Get conversation by its UUID.

- (void)getConversation:(NSString *)uuid
Parameters
uuid

Conversation UUID

–  getConversations:

Get multiple conversations by array of UUIDs. Maximum 30 conversations. Note that calling this method will result in multiple [VIMessengerDelegate messenger:didGetConversation:] events.

- (void)getConversations:(NSArray<NSString*> *)uuids
Parameters
uuids

Array of conversation UUIDs

–  setStatus:

Set user presence status. Triggers the [VIMessengerDelegate messenger:didSetStatus:] event for all messenger objects on all connected clients which are subscribed for notifications about this user. Including this one if conditions are met.

- (void)setStatus:(BOOL)online
Parameters
online

True if user is available for messaging, false otherwise

–  managePushNotifications:

Manage messenger push notification subscriptions.

- (void)managePushNotifications:(NSArray<NSNumber*> *)notifications
Parameters
notifications

Array of VIMessengerNotification to be subscribed on.

–  recreateConversation:title:distinct:enablePublicJoin:customData:uuid:sequence:moderators:lastUpdate:lastRead:createdAt:

Recreate conversation. Note that this method does not create conversation, but restore previously created conversation.

- (VIConversation *)recreateConversation:(NSArray<VIConversationParticipant*> *)participants title:(NSString *)title distinct:(BOOL)distinct enablePublicJoin:(BOOL)enablePublicJoin customData:(NSDictionary *)customData uuid:(NSString *)uuid sequence:(NSNumber *)sequnce moderators:(NSArray<NSString*> *)moderators lastUpdate:(NSNumber *)lastUpdate lastRead:(NSNumber *)lastRead createdAt:(NSNumber *)createdAt
Parameters
participants
title

Conversation title

distinct

Specify if conversation is distinct.

enablePublicJoin

If set to ‘true’, anyone can join conversation by uuid

customData

Conversation custom data

uuid

Conversation UUID

sequnce

Sequence of last event

moderators

Array of conversation’s moderators

lastUpdate

UNIX timestamp that specifies the time of the last event in the conversation

lastRead

Sequence of last event that was read by user

createdAt

UNIX timestamp that specifies the time of the conversation creation

Return

VIConversation instance

–  recreateMessage:conversation:sender:text:payload:sequence:

Recreate a message. Note that this method does not create message, but restore previously created message.

- (VIMessage *)recreateMessage:(NSString *)uuid conversation:(NSString *)conversationUUID sender:(NSString *)sender text:(NSString *)text payload:(NSArray<VIPayload*> *)payload sequence:(NSNumber *)sequence
Parameters
uuid

Universally unique identifier of message

conversationUUID

UUID of the conversation this message belongs to

sender

User id of the sender of this message

text

Text of this message

payload

Array of VIPayload objects associated with the message

sequence

Message sequence number

Return

VIMessage instance