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
HasJoinedOnce
If this channel has been successfully joined (and thus, should be rejoined on a failure)
bool HasJoinedOnce { get; }
Property Value
IsClosed
Is channel closed?
bool IsClosed { get; }
Property Value
IsErrored
Is channel erroring?
bool IsErrored { get; }
Property Value
IsJoined
Is channel joined?
bool IsJoined { get; }
Property Value
IsJoining
Is channel being joined?
bool IsJoining { get; }
Property Value
IsLeaving
Is channel leaving?
bool IsLeaving { get; }
Property Value
Options
The Channel's initialization options
ChannelOptions Options { get; }
Property Value
PostgresChangesOptions
The Channel's postgres_changes options (used prior to Subscribe(int))
List<PostgresChangesOptions> PostgresChangesOptions { get; }
Property Value
PresenceOptions
The Channel's presence options (used prior to Subscribe(int))
PresenceOptions? PresenceOptions { get; }
Property Value
State
The Channel's current state
Constants.ChannelState State { get; }
Property Value
Topic
A string representing this channel's topic, used for identifying/repeat access to this channel.
string Topic { get; }
Property Value
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.ListenTypepostgresChangeHandler
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
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
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
Returns
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
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
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.ListenTypepostgresChangeHandler
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.ChannelEventNametype
stringpayload
objecttimeoutMs
int
Returns
Subscribe(int)
Subscribes to a channel.
Task<IRealtimeChannel> Subscribe(int timeoutMs = 10000)
Parameters
timeoutMs
int
Returns
Unsubscribe()
Unsubscribes from a channel.
IRealtimeChannel Unsubscribe()