Skip to content

Commit

Permalink
Anonymous users should not connect to the WS (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanat committed Oct 7, 2023
1 parent fd2dffb commit a6a3a72
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/stream_video/lib/src/stream_video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ class StreamVideo {

/// Connects the user to the Stream Video service.
Future<Result<UserToken>> connect() async {
if (currentUserType == UserType.anonymous) {
_logger.w(() => '[connect] rejected (anonymous user)');
return Result.error(
'Cannot connect anonymous user to the WS due to Missing Permissions',
);
}
_connectOperation ??= _connect().asCancelable();
return _connectOperation!
.valueOrDefault(Result.error('connect was cancelled'))
Expand Down

0 comments on commit a6a3a72

Please sign in to comment.