IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMManager+Signalingabstract
Swift - V2TIMManager
Swift

Extensions on V2TIMManager

Methods

add​Signaling​Listener(listener:​)

public func addSignalingListener(listener: V2TIMSignalingListener)  

1.1 Add the signaling listener

remove​Signaling​Listener(listener:​)

public func removeSignalingListener(listener: V2TIMSignalingListener)  

1.2 Remove the signaling listener

invite(invitee:​data:​online​User​Only:​offline​Push​Info:​timeout:​succ:​fail:​)

public func invite(invitee: String, data: String?, onlineUserOnly: Bool, offlinePushInfo: V2TIMOfflinePushInfo?, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?  

1.3 Invite someone

Parameters

invitee String

Invitee's user ID

data String?

Custom data

timeout Int

Timeout duration, in seconds. If it is set to 0, the SDK does not perform timeout detection nor trigger the onInvitationTimeout callback.

online​User​Only Bool

Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). The invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation).

offline​Push​Info V2TIMOffline​Push​Info?

Offline push information, where the desc field is required. The information specified by desc will be displayed by default during push.

Returns

inviteID Invitation ID. If the invitation fails, null is returned.

invite​InGroup(group​ID:​invitee​List:​data:​online​User​Only:​timeout:​succ:​fail:​)

public func inviteInGroup(groupID: String, inviteeList: Array<String>, data: String?, onlineUserOnly: Bool, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?  

1.4 Invite certain users in the group

Parameters

group​ID String

ID of the inviter's group

invitee​List Array<String>

List of invitees. Invitees specified by inviteeList must be in the group specified by groupID. Otherwise, the invitation fails.

timeout Int

Timeout duration, in seconds. If it is set to 0, the SDK does not perform timeout detection nor trigger the onInvitationTimeout callback.

online​User​Only Bool

Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). The invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation).

Returns

inviteID Invitation ID. If the invitation fails, null is returned.

cancel(invite​ID:​data:​succ:​fail:​)

public func cancel(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.5 The inviter canceled the invitation

Parameters

invite​ID String

Invitation ID

accept(invite​ID:​data:​succ:​fail:​)

public func accept(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.6 The invitee accepts the invitation

reject(invite​ID:​data:​succ:​fail:​)

public func reject(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.7 The invitee rejects the invitation

get​Signalling​Info(msg:​)

public func getSignallingInfo(msg: V2TIMMessage) -> V2TIMSignalingInfo?  

1.8 Get the signaling information

If onlineUserOnly is set to false in the invite operation, a custom message is generated for each signaling operation (including the invite, cancel, accept, reject, and timeout operations). The message will be delivered to users via V2TIMAdvancedMsgListener -> onRecvNewMessage and can be pulled by users via historical message pulling. If you want to customize the display text based on the signaling information, call the following API to get the signaling information.

Parameters

msg V2TIMMessage

Message object

Returns

V2TIMSignalingInfo Signaling information. If the value is nil, msg is not a signaling message.

add​Invited​Signaling(signaling​Info:​succ:​fail:​)

public func addInvitedSignaling(signalingInfo: V2TIMSignalingInfo, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.9 Add invitation signaling (can be used for invitation signaling triggered by group offline push messages)

In offline push scenarios:

  • One-to-one invitation: if the invitee's app is killed and is started again when receiving an offline push, the user will receive the onReceiveNewInvitation callback if the invitation does not time out and receive the onInvitationTimeout callback if the invitation times out.

  • Group invitation: if the invitee's app is killed and is started again when receiving an offline push, the SDK cannot automatically sync the invitation signaling information. If you want to process the invitation in this scenario, contain the signaling information when sending the push message, parse the signaling information when receiving the push, and call addInvitedSignaling to proactively add the signaling information. TUIKit implements offline push for audio/video calls based on this API. For details of the implementation method, see Enabling Audio/Video Calls

modify​Invitation(invite​ID:​data:​succ:​fail:​)

public func modifyInvitation(inviteID: String, data: String, succ: V2TIMSucc?, fail: V2TIMFail?)  

1.10 Modify the invitaion (supported only in 6.7 and later versions)