Class SlidingSyncService
Simplified sliding sync (MSC4186), which Element X and other new clients need: room lists in windows ordered by activity, room subscriptions, and extensions for to-device messages, encryption, account data, receipts and typing.
Inherited Members
Namespace: Uniform.Matrix.Server.Sync
Assembly: Uniform.Matrix.Server.dll
Syntax
public sealed class SlidingSyncService
Remarks
Rooms are built by SyncService: from the start for rooms the connection has not had yet, and since the client's position for the others, then reshaped.
Connections are kept in memory per user, device and conn_id; a position the server does not know, e.g. after a restart, gets M_UNKNOWN_POS, after which the client starts over.
Each request uses the largest timeline limit it asks for, and lazy members when any room config asks for them.
Constructors
| Edit this page View SourceSlidingSyncService(SyncService, IDbContextFactory<ServerDbContext>, ServerStream, TimeProvider)
Create the service.
Declaration
public SlidingSyncService(SyncService sync, IDbContextFactory<ServerDbContext> contexts, ServerStream stream, TimeProvider time)
Parameters
| Type | Name | Description |
|---|---|---|
| SyncService | sync | |
| IDbContextFactory<ServerDbContext> | contexts | |
| ServerStream | stream | |
| TimeProvider | time |
Fields
| Edit this page View SourceUnknownPos
Error code that makes clients start their sliding sync connection over.
Declaration
public const string UnknownPos = "M_UNKNOWN_POS"
Field Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceSyncAsync(Requester, string?, TimeSpan, JsonObject, CancellationToken)
Answer a sliding sync request; wait up to timeout for something new when there is nothing yet.
Declaration
public Task<JsonObject> SyncAsync(Requester requester, string? pos, TimeSpan timeout, JsonObject body, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Requester | requester | User and device. |
| string | pos | Position of the previous answer, or null to start. |
| TimeSpan | timeout | How long to wait for news. |
| JsonObject | body | The request: |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<JsonObject> |