2using System.Collections.Generic;
4using System.Threading.Tasks;
7using HotChocolate.Execution;
8using HotChocolate.Types;
9using HotChocolate.Types.Relay;
45 => $
"{UserUpdatedTopic}.{userId}";
55 [ID(nameof(
User))]
long? userId,
57 CancellationToken cancellationToken)
59 ArgumentNullException.ThrowIfNull(receiver);
61 return receiver.SubscribeAsync<
User>(topic, cancellationToken);
72 ArgumentNullException.ThrowIfNull(user);
86 CancellationToken cancellationToken)
88 ArgumentNullException.ThrowIfNull(receiver);
89 ArgumentNullException.ThrowIfNull(authenticationContext);
90 return receiver.SubscribeAsync<
User>(
SpecificUserUpdatedTopic(Models.ModelExtensions.Require(authenticationContext.User, user => user.Id)), cancellationToken);
101 ArgumentNullException.ThrowIfNull(user);
Root type for GraphQL subscriptions.
const string GraphQLDescription
Description to show on the Subscription type.
static string SpecificUserUpdatedTopic(long userId)
The name of the topic for when a specific Models.User is updated.
static IEnumerable< string > UserUpdatedTopics(long userId)
Get the names of the topics to send to when a Models.User is updated.
ValueTask< ISourceStream< User > > CurrentUserUpdatedStream([Service] ITopicEventReceiver receiver, [Service] IAuthenticationContext authenticationContext, CancellationToken cancellationToken)
ISourceStream for CurrentUserUpdated(User).
ValueTask< ISourceStream< User > > UserUpdatedStream([ID(nameof(User))] long? userId, [Service] ITopicEventReceiver receiver, CancellationToken cancellationToken)
ISourceStream for UserUpdated(User).
User CurrentUserUpdated([EventMessage] User user)
Receive an update to the logged in User when it is changed.
User UserUpdated([EventMessage] User user)
Receive an update for all User changes.
const string UserUpdatedTopic
The name of the topic for when any user is updated.
A user registered in the server.
Implementation of HotChocolate.Subscriptions.ITopicEventReceiver that works around the global::System...
For creating and accessing authentication contexts.