Table of Contents

Interface IRealtimeChannel

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

A contract representing a realtime channel

public interface IRealtimeChannel

Properties

BroadcastOptions

The Channel's broadcast options (used prior to Subscribe(int))

BroadcastOptions? BroadcastOptions { get; }

Property Value

BroadcastOptions

HasJoinedOnce

If this channel has been successfully joined (and thus, should be rejoined on a failure)

bool HasJoinedOnce { get; }

Property Value

bool

IsClosed

Is channel closed?

bool IsClosed { get; }

Property Value

bool

IsErrored

Is channel erroring?

bool IsErrored { get; }

Property Value

bool

IsJoined

Is channel joined?

bool IsJoined { get; }

Property Value

bool

IsJoining

Is channel being joined?

bool IsJoining { get; }

Property Value

bool

IsLeaving

Is channel leaving?

bool IsLeaving { get; }

Property Value

bool

Options

The Channel's initialization options

ChannelOptions Options { get; }

Property Value

ChannelOptions

PostgresChangesOptions

The Channel's postgres_changes options (used prior to Subscribe(int))

List<PostgresChangesOptions> PostgresChangesOptions { get; }

Property Value

List<PostgresChangesOptions>

PresenceOptions

The Channel's presence options (used prior to Subscribe(int))

PresenceOptions? PresenceOptions { get; }

Property Value

PresenceOptions

State

The Channel's current state

Constants.ChannelState State { get; }

Property Value

Constants.ChannelState

Topic

A string representing this channel's topic, used for identifying/repeat access to this channel.

string Topic { get; }

Property Value

string

Methods

AddErrorHandler(ErrorEventHandler)

Add an error handler

void AddErrorHandler(IRealtimeChannel.ErrorEventHandler handler)

Parameters

handler IRealtimeChannel.ErrorEventHandler

AddMessageReceivedHandler(MessageReceivedHandler)

Add a message received handler

void AddMessageReceivedHandler(IRealtimeChannel.MessageReceivedHandler messageReceivedHandler)

Parameters

messageReceivedHandler IRealtimeChannel.MessageReceivedHandler

AddPostgresChangeHandler(ListenType, PostgresChangesHandler)

Add a postgres_changes handler

void AddPostgresChangeHandler(PostgresChangesOptions.ListenType listenType, IRealtimeChannel.PostgresChangesHandler postgresChangeHandler)

Parameters

listenType PostgresChangesOptions.ListenType
postgresChangeHandler IRealtimeChannel.PostgresChangesHandler

AddStateChangedHandler(StateChangedHandler)

Add a state changed listener

void AddStateChangedHandler(IRealtimeChannel.StateChangedHandler stateChangedHandler)

Parameters

stateChangedHandler IRealtimeChannel.StateChangedHandler

Broadcast()

Get the IRealtimeBroadcast helper

IRealtimeBroadcast? Broadcast()

Returns

IRealtimeBroadcast

ClearErrorHandlers()

Clear error handlers.

void ClearErrorHandlers()

ClearMessageReceivedHandlers()

Clear message received handlers.

void ClearMessageReceivedHandlers()

ClearPostgresChangeHandlers()

Clear postgres_changes handlers

void ClearPostgresChangeHandlers()

ClearStateChangedHandlers()

Clear state changed handlers

void ClearStateChangedHandlers()

Presence()

Get the IRealtimePresence helper.

IRealtimePresence? Presence()

Returns

IRealtimePresence

Push(string, string?, object?, int)

Push an arbitrary event to a subscribed channel.

Push Push(string eventName, string? type = null, object? payload = null, int timeoutMs = 10000)

Parameters

eventName string
type string
payload object
timeoutMs int

Returns

Push

Register(PostgresChangesOptions)

Register postgres_changes options, must be called to use IRealtimeChannel.PostgresChangesHandler, and prior to Subscribe(int)

IRealtimeChannel Register(PostgresChangesOptions postgresChangesOptions)

Parameters

postgresChangesOptions PostgresChangesOptions

Returns

IRealtimeChannel

Register<TBroadcastResponse>(bool, bool)

Register broadcast options, must be called to use IRealtimeBroadcast, and prior to Subscribe(int)

RealtimeBroadcast<TBroadcastResponse> Register<TBroadcastResponse>(bool broadcastSelf = false, bool broadcastAck = false) where TBroadcastResponse : BaseBroadcast

Parameters

broadcastSelf bool
broadcastAck bool

Returns

RealtimeBroadcast<TBroadcastResponse>

Type Parameters

TBroadcastResponse

Register<TPresenceResponse>(string)

Register presence options, must be called to use IRealtimePresence, and prior to Subscribe(int)

RealtimePresence<TPresenceResponse> Register<TPresenceResponse>(string presenceKey) where TPresenceResponse : BasePresence

Parameters

presenceKey string

Returns

RealtimePresence<TPresenceResponse>

Type Parameters

TPresenceResponse

Rejoin(int)

Rejoin a channel.

void Rejoin(int timeoutMs = 10000)

Parameters

timeoutMs int

RemoveErrorHandler(ErrorEventHandler)

Remove an error handler

void RemoveErrorHandler(IRealtimeChannel.ErrorEventHandler handler)

Parameters

handler IRealtimeChannel.ErrorEventHandler

RemoveMessageReceivedHandler(MessageReceivedHandler)

Remove a message received handler.

void RemoveMessageReceivedHandler(IRealtimeChannel.MessageReceivedHandler messageReceivedHandler)

Parameters

messageReceivedHandler IRealtimeChannel.MessageReceivedHandler

RemovePostgresChangeHandler(ListenType, PostgresChangesHandler)

Remove a postgres_changes handler

void RemovePostgresChangeHandler(PostgresChangesOptions.ListenType listenType, IRealtimeChannel.PostgresChangesHandler postgresChangeHandler)

Parameters

listenType PostgresChangesOptions.ListenType
postgresChangeHandler IRealtimeChannel.PostgresChangesHandler

RemoveStateChangedHandler(StateChangedHandler)

Remove a state changed handler

void RemoveStateChangedHandler(IRealtimeChannel.StateChangedHandler stateChangedHandler)

Parameters

stateChangedHandler IRealtimeChannel.StateChangedHandler

Send(ChannelEventName, string?, object, int)

Send an arbitrary event with an awaitable task.

Task<bool> Send(Constants.ChannelEventName eventType, string? type, object payload, int timeoutMs = 10000)

Parameters

eventType Constants.ChannelEventName
type string
payload object
timeoutMs int

Returns

Task<bool>

Subscribe(int)

Subscribes to a channel.

Task<IRealtimeChannel> Subscribe(int timeoutMs = 10000)

Parameters

timeoutMs int

Returns

Task<IRealtimeChannel>

Unsubscribe()

Unsubscribes from a channel.

IRealtimeChannel Unsubscribe()

Returns

IRealtimeChannel