joinChannelWithUserAccount method
Joins the channel with a user account.
After the user successfully joins the channel, the SDK triggers the following callbacks:
- The local client: RtcEngineEventHandler.localUserRegistered and RtcEngineEventHandler.joinChannelSuccess.
- The remote client: RtcEngineEventHandler.userJoined and RtcEngineEventHandler.userInfoUpdated, if the user joining the channel is in the ChannelProfile.Communication profile, or is a ClientRole.Broadcaster in the ChannelProfile.LiveBroadcasting profile.
Note
- To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Meta Web SDK, ensure that the uid of the user is set to the same parameter type.
Parameter token
The token generated at your server:
- In situations not requiring high security: You can use the temporary token generated at Console. For details, see
Get a temporary token
. - In situations requiring high security: Set it as the token generated at your server. For details, see
Get a token
.
Parameter channelName
The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "
", "
", "^", "_", " {", "}", "|", "~", ",".
Parameter userAccount
The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null.
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "
", "
", "^", "_", " {", "}", "|", "~", ",".
Implementation
@override
Future<void> joinChannelWithUserAccount(
String token, String channelName, String userAccount) {
return _invokeMethod('joinChannelWithUserAccount', {
'token': token,
'channelName': channelName,
'userAccount': userAccount
});
}