SeuraaEdge
v1
Docs/SDKs
SDKs

Connect .NET applications with the .NET 10 client.

.NET Client SDK

The .NET client connects .NET 10 applications to Edge.

Installation

Install Seuraa.Edge from NuGet:

bash
dotnet add package Seuraa.Edge

Client

csharp
using Seuraa.Edge;

await using var edge = new Client(new ClientOptions
{
    AppKey = "app-key",
    Auth = new Uri("https://api.example.com/seuraa/token"),
});

The auth URL receives the app key and channel name and returns a short-lived channel token.

Use TokenProvider instead when the application needs custom authentication headers or token-fetching behavior.

Subscribe

csharp
public sealed record Notification(string Title);

var channel = edge.Channel("private:user-123");

using var subscription = channel.Subscribe<Notification>(
    "notification.created",
    notification => Console.WriteLine(notification.Data.Title));

Disposing subscription removes only that event handler. Call channel.UnsubscribeAsync() to leave the channel.

Publish

csharp
var result = await channel.PublishAsync(
    "typing.started",
    new { documentId = "document-123" });

Publishing is asynchronous because the SDK may refresh the channel token.

Connection Status

csharp
await foreach (var state in edge.Status())
{
    Console.WriteLine(state.Status);
}

The client reconnects automatically and restores active channel subscriptions. On plans with persisted replay, it also resumes channels using their latest event cursors.

Presence And Errors

csharp
using var rawEvents = channel.OnRawEvent(edgeEvent =>
{
    switch (edgeEvent)
    {
        case PresenceUpdated update:
            Console.WriteLine(update.Presence?.Count ?? 0);
            break;
        case ServerError error:
            Console.WriteLine(error.Code);
            break;
    }
});

Dispose the client with await using when it is no longer needed.