C#: Connection state

Returns the current state of the Realtime connection: Closed, Connecting, or Open.

Examples

Read the connection state

var state = supabase.Realtime.ConnectionState;

if (state == Supabase.Realtime.Constants.ConnectionState.Open)
{
    Debug.WriteLine("Connected");
}

Listen to socket state changes

supabase.Realtime.AddStateChangedHandler((sender, state) =>
{
    Debug.WriteLine($"Socket state: {state}");
});