invite
Introduction
Invite another user with signaling message.
Parameter details
Parameter name |
Parameter type |
Required |
Platform |
Description |
invitee |
String |
yes |
All |
The ID of the target user to invite. |
data |
String |
yes |
All |
The custom data carried by the invitation. |
timeout |
int |
no |
All |
The timeout configuration of the invitation. 30 seconds as default, while 0 represent will not timeout. |
onlineUserOnly |
bool |
no |
All |
Whether the message can be received by online users only. |
offlinePushInfo |
OfflinePushInfo |
no |
All |
Offline push information. The title, body and external content carried and shown when a message is pushed offline. |
Returned template
V2TimValueCallback<String>
{
code : int
desc : String
data : String
}
Return value details
name |
type |
description |
code |
int |
Request result: Error codes. 0 means success. |
desc |
String |
The description of the error. It will be empty if success. |
data |
bool |
The ID of the invitation created. |
Code example
V2TimSignalingListener listener = V2TimSignalingListener(
onInvitationCancelled:
(String inviteID, String inviter, String data) async {},
onInvitationTimeout: (String inviteID, List<String> inviteeList) async {
},
onInviteeAccepted: (String inviteID, String invitee, String data) async {
},
onInviteeRejected: (String inviteID, String invitee, String data) async {
},
onReceiveNewInvitation: (String inviteID, String inviter, String groupID,
List<String> inviteeList, String data) async {
},
);
TencentImSDKPlugin.v2TIMManager
.getSignalingManager()
.addSignalingListener(listener: listener);
V2TimValueCallback<String> inviteRes = await TencentImSDKPlugin.v2TIMManager
.getSignalingManager()
.invite(
invitee: "",
data: "data",
timeout: 30,
onlineUserOnly: false,
offlinePushInfo: OfflinePushInfo());
if (inviteRes.code == 0) {
String? inviteId = inviteRes.data;
}