Table of Contents

Interface IRealtimeClient<TSocket, TChannel>

Namespace
Supabase.Realtime.Interfaces
Assembly
Supabase.Realtime.dll

Contract representing a Realtime Client

public interface IRealtimeClient<TSocket, TChannel> where TSocket : IRealtimeSocket where TChannel : IRealtimeChannel

Type Parameters

TSocket
TChannel

Properties

Options

The options initializing this client.

ClientOptions Options { get; }

Property Value

ClientOptions

SerializerSettings

Json serializer settings

JsonSerializerSettings SerializerSettings { get; }

Property Value

JsonSerializerSettings

Socket

The connected realtime socket

IRealtimeSocket? Socket { get; }

Property Value

IRealtimeSocket

Subscriptions

A collection of channels ordered by topic name

ReadOnlyDictionary<string, TChannel> Subscriptions { get; }

Property Value

ReadOnlyDictionary<string, TChannel>

Methods

AddDebugHandler(DebugEventHandler)

Adds a debug handler, likely used within a logging solution of some kind.

void AddDebugHandler(IRealtimeDebugger.DebugEventHandler handler)

Parameters

handler IRealtimeDebugger.DebugEventHandler

AddStateChangedHandler(SocketStateEventHandler)

Add a Socket State listener

void AddStateChangedHandler(IRealtimeClient<TSocket, TChannel>.SocketStateEventHandler handler)

Parameters

handler IRealtimeClient<TSocket, TChannel>.SocketStateEventHandler

Channel(string)

Initialize a new channel with an arbitrary channel name.

TChannel Channel(string channelName)

Parameters

channelName string

Returns

TChannel

Channel(string, string, string, string?, string?, Dictionary<string, string>?)

Shorthand initialization of a channel with postgres_changes options already set.

TChannel Channel(string database = "realtime", string schema = "public", string table = "*", string? column = null, string? value = null, Dictionary<string, string>? parameters = null)

Parameters

database string
schema string
table string
column string
value string
parameters Dictionary<string, string>

Returns

TChannel

ClearDebugHandlers()

Clears debug handlers;

void ClearDebugHandlers()

ClearStateChangedHandlers()

Clear socket state listeners

void ClearStateChangedHandlers()

Connect(Action<IRealtimeClient<TSocket, TChannel>, RealtimeException?>?)

Connect to the Socket

IRealtimeClient<TSocket, TChannel> Connect(Action<IRealtimeClient<TSocket, TChannel>, RealtimeException?>? callback = null)

Parameters

callback Action<IRealtimeClient<TSocket, TChannel>, RealtimeException>

Returns

IRealtimeClient<TSocket, TChannel>

ConnectAsync()

Connect to the Socket

Task<IRealtimeClient<TSocket, TChannel>> ConnectAsync()

Returns

Task<IRealtimeClient<TSocket, TChannel>>

Disconnect(WebSocketCloseStatus, string)

Disconnect from the Socket

IRealtimeClient<TSocket, TChannel> Disconnect(WebSocketCloseStatus code = WebSocketCloseStatus.NormalClosure, string reason = "Programmatic Disconnect")

Parameters

code WebSocketCloseStatus
reason string

Returns

IRealtimeClient<TSocket, TChannel>

Remove(TChannel)

Remove an initialized IRealtimeChannel

void Remove(TChannel channel)

Parameters

channel TChannel

RemoveDebugHandler(DebugEventHandler)

Removes a debug handler

void RemoveDebugHandler(IRealtimeDebugger.DebugEventHandler handler)

Parameters

handler IRealtimeDebugger.DebugEventHandler

RemoveStateChangedHandler(SocketStateEventHandler)

Remove a Socket State listener

void RemoveStateChangedHandler(IRealtimeClient<TSocket, TChannel>.SocketStateEventHandler handler)

Parameters

handler IRealtimeClient<TSocket, TChannel>.SocketStateEventHandler

SetAuth(string)

Sets the authentication JWT to be passed into all realtime channels. Used for WALRUS permissions.

void SetAuth(string jwt)

Parameters

jwt string