joinChannel method
Future<void>
joinChannel(
- String token,
- String optionalInfo,
- int optionalUid,
- ChannelMediaOptions options,
Joins the channel with a user ID.
Note
- If you are already in a channel, you cannot rejoin it with the same uid.
- We recommend using different UIDs for different channels.
- If you want to join the same channel from different devices, ensure that the UIDs in all devices are different.
- Ensure that the app ID you use to generate the token is the same with the app ID used when creating the RtcEngine instance.
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 optionalInfo
Additional information about the channel. This parameter can be set as null. Other users in the channel do not receive this information.
Parameter optionalUid
The user ID. A 32-bit unsigned integer with a value ranging from 1 to (232-1). This parameter must be unique. If uid is not assigned (or set as 0), the SDK assigns a uid and reports it in the onJoinChannelSuccess callback. The app must maintain this user ID.
Parameter options
The channel media options. See ChannelMediaOptions.
Implementation
@override
Future<void> joinChannel(String token, String optionalInfo, int optionalUid,
ChannelMediaOptions options) {
return _invokeMethod('joinChannel', {
'token': token,
'optionalInfo': optionalInfo,
'optionalUid': optionalUid,
'options': options.toJson()
});
}