C#: Presence options

Controls whether a channel receives presence updates from other clients. Register<T>(presenceKey) enables presence. Use PresenceOptions.WithoutPresence() when this client only needs to make itself visible with Track().

Examples

Receive presence updates

var channel = supabase.Realtime.Channel("room");
var presence = channel.Register<UserPresence>(PresenceOptions.WithPresence("user-1"));

await channel.Subscribe();

Track without receiving updates

var channel = supabase.Realtime.Channel("room");
var presence = channel.Register<UserPresence>(PresenceOptions.WithoutPresence("user-1"));

await channel.Subscribe();
presence.Track(new UserPresence { LastSeen = DateTime.UtcNow });