PhoenixKit.Users.ScopeNotifier (phoenix_kit v1.5.1)
View SourceHandles PubSub notifications for user scope refreshes.
When a user's roles change, we broadcast a message on a user-specific topic so any connected LiveViews can refresh their cached authentication scope without requiring a full reconnect.
Summary
Functions
Broadcasts a scope refresh notification for the given user.
Subscribes the current process to scope refresh notifications for the user.
Unsubscribes the current process from scope refresh notifications.
Functions
@spec broadcast_roles_updated(PhoenixKit.Users.Auth.User.t() | integer() | nil) :: :ok
Broadcasts a scope refresh notification for the given user.
@spec subscribe(PhoenixKit.Users.Auth.User.t() | integer()) :: :ok | {:error, term()}
Subscribes the current process to scope refresh notifications for the user.
@spec unsubscribe(PhoenixKit.Users.Auth.User.t() | integer() | nil) :: :ok
Unsubscribes the current process from scope refresh notifications.