SeuraaEdge
v1
Docs/SDKs
SDKs

Connect .NET applications with the .NET 10 client.

.NET Client SDK

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

Installation

Use the SDK version and package source supplied with your Seuraa account:

bash
dotnet add package Seuraa.Edge

Client

csharp
using Seuraa.Edge;

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

The authentication endpoint 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 resumes active 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.