reconnect method
Reconnect to the network and join the room again.
If already connected, disconnect once and then reconnect.
ネットワークに再接続し再度ルームにジョインします。
すでに接続されている場合、一度切断してから再接続します。
Implementation
Future<void> reconnect() async {
if (_reconnectCompleter != null) {
return _reconnectCompleter!.future;
}
_reconnectCompleter = Completer();
try {
await disconnect();
_token = null;
await _release();
await connect(
userName: _localName ?? "",
videoProfile: _videoProfile,
cameraDirection: _cameraDirection,
enableAudio: _enableAudio,
enableVideo: _enableVideo,
channelProfile: _channelProfile,
clientRole: _clientRole,
orientation: _orientation,
enableCustomVideoSource: _enableCustomVideoSource,
onReceivedDataStream: _onReceivedDataStream,
);
_reconnectCompleter?.complete();
_reconnectCompleter = null;
} catch (e, stacktrace) {
_reconnectCompleter?.completeError(e, stacktrace);
_reconnectCompleter = null;
rethrow;
} finally {
_reconnectCompleter?.complete();
_reconnectCompleter = null;
}
}