Class PushNotifier
Sends push notifications: follows the ServerStream, runs the push rules of the room's members on each new event, and posts to the push gateways of their http pushers.
Inherited Members
Namespace: Uniform.Matrix.Server.Accounts
Assembly: Uniform.Matrix.Server.dll
Syntax
public sealed class PushNotifier : BackgroundService, IHostedService, IDisposable
Remarks
Gateways are called outside every lock, one pusher at a time; a failing gateway is logged and skipped. Push keys a gateway rejects are deleted. Events from before the server started are not pushed.
Constructors
| Edit this page View SourcePushNotifier(IDbContextFactory<ServerDbContext>, ServerStream, PushRuleService, PusherService, IHttpClientFactory, IOptionsMonitor<PushOptions>, ILogger<PushNotifier>)
Create the notifier.
Declaration
public PushNotifier(IDbContextFactory<ServerDbContext> contexts, ServerStream stream, PushRuleService pushRules, PusherService pushers, IHttpClientFactory httpClients, IOptionsMonitor<PushOptions> options, ILogger<PushNotifier> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbContextFactory<ServerDbContext> | contexts | |
| ServerStream | stream | |
| PushRuleService | pushRules | |
| PusherService | pushers | |
| IHttpClientFactory | httpClients | |
| IOptionsMonitor<PushOptions> | options | |
| ILogger<PushNotifier> | logger |
Fields
| Edit this page View SourceHttpClientName
Name of the HTTP client that reaches gateways.
Declaration
public const string HttpClientName = "Uniform.Matrix.Server.Push"
Field Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceCreateHandler(IOptionsMonitor<PushOptions>)
Return the HTTP handler of the gateway client: it connects only to public addresses unless AllowPrivateGateways is on.
Declaration
public static SocketsHttpHandler CreateHandler(IOptionsMonitor<PushOptions> options)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptionsMonitor<PushOptions> | options |
Returns
| Type | Description |
|---|---|
| SocketsHttpHandler |
ExecuteAsync(CancellationToken)
Follow the stream until the server stops, pushing the events of each new position.
Declaration
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | stoppingToken |
Returns
| Type | Description |
|---|---|
| Task |