Adds handlers that run once for each presence key that gains or loses presences. The handler receives the key and the presences involved.
Key, CurrentPresences (what the key already had, empty for a new key), and NewPresences.Key, CurrentPresences (what the key still has), and LeftPresences.CurrentState changes.RemoveJoinHandler() and RemoveLeaveHandler().var channel = supabase.Realtime.Channel("room");
var presence = channel.Register<UserPresence>("user-1");
presence.AddJoinHandler(join =>
{
Debug.WriteLine($"{join.Key} joined: {join.NewPresences.Count} new");
});
presence.AddLeaveHandler(leave =>
{
Debug.WriteLine($"{leave.Key} left: {leave.LeftPresences.Count} gone");
});
await channel.Subscribe();