Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Jan 8, 2024
1 parent afd4ea5 commit b45d2c9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/src/core/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ extension RoomPrivateMethods on Room {

/// server assigned unique room id.
/// returns once a sid has been issued by the server.
Future<String> getSid() async {
if (engine.connectionState == ConnectionState.disconnected) {
return '';
Expand All @@ -736,16 +735,16 @@ extension RoomPrivateMethods on Room {

final completer = Completer<String>();

unawaited(events
.waitFor<SignalRoomUpdateEvent>(
duration: connectOptions.timeouts.connection,
filter: (event) => event.room.sid.isNotEmpty)
.then((event) {
completer.complete(event.room.sid);
}));
events.on<SignalRoomUpdateEvent>((event) {
if (event.room.sid.isNotEmpty && !completer.isCompleted) {
completer.complete(event.room.sid);
}
});

events.on<RoomDisconnectedEvent>((event) {
completer.complete('');
if (!completer.isCompleted) {
completer.complete('');
}
});

return completer.future;
Expand Down

0 comments on commit b45d2c9

Please sign in to comment.