Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/fix-signal-resume-events
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch type="fixed" "Fix missing RoomReconnectedEvent and incorrect SyncState timing during signal-only reconnection"
6 changes: 5 additions & 1 deletion lib/src/core/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
..on<EngineResumedEvent>((event) async {
// re-send tracks permissions
localParticipant?.sendTrackSubscriptionPermissions();
events.emit(const RoomReconnectedEvent());
notifyListeners();
})
..on<EngineFullRestartingEvent>((event) async {
Expand Down Expand Up @@ -536,9 +537,12 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
notifyListeners();
})
..on<EngineResumingEvent>((event) async {
await _sendSyncState();
events.emit(const RoomResumingEvent());
notifyListeners();
})
..on<SignalReconnectedEvent>((event) async {
await _sendSyncState();
})
..on<EngineAttemptReconnectEvent>((event) async {
events.emit(RoomAttemptReconnectEvent(
attempt: event.attempt,
Expand Down
18 changes: 16 additions & 2 deletions lib/src/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,30 @@ class RoomConnectedEvent with RoomEvent {
String toString() => '${runtimeType}(room: ${room}, metadata: ${metadata})';
}

/// Base type for reconnecting events. Listen for this type to handle
/// both full reconnects and signal-only reconnects.
mixin ReconnectingEvent implements RoomEvent {}

/// When the connection to the server has been interrupted and it's attempting
/// to reconnect.
/// a full reconnect (peer connections are reset, media is interrupted).
/// Emitted by [Room].
class RoomReconnectingEvent with RoomEvent {
class RoomReconnectingEvent with RoomEvent, ReconnectingEvent {
const RoomReconnectingEvent();

@override
String toString() => '${runtimeType}()';
}

/// When the signal connection has been interrupted and it's attempting
/// to resume. Peer connections remain active during this type of reconnect.
/// Emitted by [Room].
class RoomResumingEvent with RoomEvent, ReconnectingEvent {
const RoomResumingEvent();

@override
String toString() => '${runtimeType}()';
}

/// report the number of attempts to reconnect to the room.
class RoomAttemptReconnectEvent with RoomEvent {
final int attempt;
Expand Down
Loading