Add sid for reconnecting. (#168)
This commit is contained in:
@@ -71,6 +71,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
|||||||
FastConnectOptions? fastConnectOptions;
|
FastConnectOptions? fastConnectOptions;
|
||||||
|
|
||||||
bool _subscriberPrimary = false;
|
bool _subscriberPrimary = false;
|
||||||
|
String? _participantSid;
|
||||||
|
|
||||||
// server-provided ice servers
|
// server-provided ice servers
|
||||||
List<lk_rtc.ICEServer> _serverProvidedIceServers = [];
|
List<lk_rtc.ICEServer> _serverProvidedIceServers = [];
|
||||||
@@ -284,6 +285,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
|||||||
connectOptions: connectOptions,
|
connectOptions: connectOptions,
|
||||||
roomOptions: roomOptions,
|
roomOptions: roomOptions,
|
||||||
reconnect: true,
|
reconnect: true,
|
||||||
|
sid: _participantSid,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (publisher == null || subscriber == null) {
|
if (publisher == null || subscriber == null) {
|
||||||
@@ -593,6 +595,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
|||||||
// create peer connections
|
// create peer connections
|
||||||
_subscriberPrimary = event.response.subscriberPrimary;
|
_subscriberPrimary = event.response.subscriberPrimary;
|
||||||
_serverProvidedIceServers = event.response.iceServers;
|
_serverProvidedIceServers = event.response.iceServers;
|
||||||
|
_participantSid = event.response.participant.sid;
|
||||||
|
|
||||||
logger.fine('onConnected subscriberPrimary: ${_subscriberPrimary}, '
|
logger.fine('onConnected subscriberPrimary: ${_subscriberPrimary}, '
|
||||||
'serverVersion: ${event.response.serverVersion}, '
|
'serverVersion: ${event.response.serverVersion}, '
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class SignalClient extends Disposable with EventsEmittable<SignalEvent> {
|
|||||||
required ConnectOptions connectOptions,
|
required ConnectOptions connectOptions,
|
||||||
required RoomOptions roomOptions,
|
required RoomOptions roomOptions,
|
||||||
bool reconnect = false,
|
bool reconnect = false,
|
||||||
|
String? sid,
|
||||||
}) async {
|
}) async {
|
||||||
final rtcUri = await Utils.buildUri(
|
final rtcUri = await Utils.buildUri(
|
||||||
uriString,
|
uriString,
|
||||||
@@ -61,6 +62,7 @@ class SignalClient extends Disposable with EventsEmittable<SignalEvent> {
|
|||||||
connectOptions: connectOptions,
|
connectOptions: connectOptions,
|
||||||
roomOptions: roomOptions,
|
roomOptions: roomOptions,
|
||||||
reconnect: reconnect,
|
reconnect: reconnect,
|
||||||
|
sid: sid,
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.fine('SignalClient connecting with url: $rtcUri');
|
logger.fine('SignalClient connecting with url: $rtcUri');
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ class Utils {
|
|||||||
bool reconnect = false,
|
bool reconnect = false,
|
||||||
bool validate = false,
|
bool validate = false,
|
||||||
bool forceSecure = false,
|
bool forceSecure = false,
|
||||||
|
String? sid,
|
||||||
}) async {
|
}) async {
|
||||||
final Uri uri = Uri.parse(uriString);
|
final Uri uri = Uri.parse(uriString);
|
||||||
|
|
||||||
@@ -171,6 +172,7 @@ class Utils {
|
|||||||
'auto_subscribe': connectOptions.autoSubscribe ? '1' : '0',
|
'auto_subscribe': connectOptions.autoSubscribe ? '1' : '0',
|
||||||
'adaptive_stream': roomOptions.adaptiveStream ? '1' : '0',
|
'adaptive_stream': roomOptions.adaptiveStream ? '1' : '0',
|
||||||
if (reconnect) 'reconnect': '1',
|
if (reconnect) 'reconnect': '1',
|
||||||
|
if (reconnect && sid != null) 'sid': sid,
|
||||||
'protocol': connectOptions.protocolVersion.toStringValue(),
|
'protocol': connectOptions.protocolVersion.toStringValue(),
|
||||||
'sdk': 'flutter',
|
'sdk': 'flutter',
|
||||||
'version': LiveKitClient.version,
|
'version': LiveKitClient.version,
|
||||||
|
|||||||
Reference in New Issue
Block a user