Class DelayedLeaveKeeper
Keeps the delayed leaves (MSC4140) that members handed over: while a member is on LiveKit, its delayed leave is restarted before it goes off; once LiveKit no longer has the member, the leave is sent at once, so the member's call membership ends.
Implements
Inherited Members
Namespace: Uniform.LiveKit.Authorization
Assembly: Uniform.LiveKit.Authorization.dll
Syntax
public sealed class DelayedLeaveKeeper : IAsyncDisposable
Remarks
A job waits for the member to appear in its LiveKit room, up to the delay, then looks every CheckInterval whether it is still there; it restarts the delayed event at four fifths of its delay, as lk-jwt-service does. A job of the same member in the same room replaces the earlier one. Jobs live in memory: after a restart of the service, the homeserver sends a member's leave when its delay runs out.
Constructors
| Edit this page View SourceDelayedLeaveKeeper(Func<LiveKitAuthorizerOptions>, IDelayedEvents, HttpClient, TimeProvider, ILogger<DelayedLeaveKeeper>)
Keeps the delayed leaves (MSC4140) that members handed over: while a member is on LiveKit, its delayed leave is restarted before it goes off; once LiveKit no longer has the member, the leave is sent at once, so the member's call membership ends.
Declaration
public DelayedLeaveKeeper(Func<LiveKitAuthorizerOptions> options, IDelayedEvents events, HttpClient http, TimeProvider time, ILogger<DelayedLeaveKeeper> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<LiveKitAuthorizerOptions> | options | The current settings, for LiveKit's URL and keys. |
| IDelayedEvents | events | Acts on the delayed events at the members' homeservers. |
| HttpClient | http | The client of LiveKit's room service. |
| TimeProvider | time | The clock. |
| ILogger<DelayedLeaveKeeper> | logger | Logger of the jobs. |
Remarks
A job waits for the member to appear in its LiveKit room, up to the delay, then looks every CheckInterval whether it is still there; it restarts the delayed event at four fifths of its delay, as lk-jwt-service does. A job of the same member in the same room replaces the earlier one. Jobs live in memory: after a restart of the service, the homeserver sends a member's leave when its delay runs out.
Fields
| Edit this page View SourceCheckInterval
How often a job looks whether its member is still on LiveKit.
Declaration
public static readonly TimeSpan CheckInterval
Field Value
| Type | Description |
|---|---|
| TimeSpan |
MostDelay
The longest delay taken, as lk-jwt-service takes.
Declaration
public static readonly TimeSpan MostDelay
Field Value
| Type | Description |
|---|---|
| TimeSpan |
Properties
| Edit this page View SourceMembers
The members whose leaves are kept now, by LiveKit room and identity.
Declaration
public IReadOnlyCollection<(string Room, string Identity)> Members { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<(string UserId, string DeviceId)> |
Methods
| Edit this page View SourceDisposeAsync()
Stop all jobs, leaving the delayed events to the homeservers.
Declaration
public ValueTask DisposeAsync()
Returns
| Type | Description |
|---|---|
| ValueTask |
Keep(string, string, TimeSpan, string, string)
Keep the delayed leave delayId of a user of serverName, whose participant is identity in LiveKit room room, with a delay of delay.
Declaration
public void Keep(string serverName, string delayId, TimeSpan delay, string room, string identity)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serverName | |
| string | delayId | |
| TimeSpan | delay | |
| string | room | |
| string | identity |