Class Push | realtime-csharp (original) (raw)

Namespace

Supabase.Realtime.Channel

Assembly

Supabase.Realtime.dll

Class representation of a single request sent to the Socket server.

Push also adds additional functionality for retrying, timeouts, and listeners for its associated response from the server.

public class Push : IRealtimePush<RealtimeChannel, SocketResponse>

Inheritance

Push

Implements

Inherited Members

Constructors

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

Initializes a single request that will be Pushed to the Socket server.

public Push(IRealtimeSocket socket, RealtimeChannel channel, string eventName, string? type = null, object? payload = null, int timeoutMs = 10000)

Parameters

socket IRealtimeSocket

channel RealtimeChannel

eventName string

type string

payload object

timeoutMs int

Properties

Channel

The associated channel.

public RealtimeChannel Channel { get; }

Property Value

RealtimeChannel

EventName

The event requested.

public string EventName { get; }

Property Value

string

IsSent

Flag representing the sent state of a request.

public bool IsSent { get; }

Property Value

bool

Message

Represents the Pushed (sent) Message

public SocketRequest? Message { get; }

Property Value

SocketRequest

Payload

Payload of data to be sent.

public object? Payload { get; }

Property Value

object

Ref

Ref Of this Message

public string? Ref { get; }

Property Value

string

Response

Accessor for the returned Socket Response

public IRealtimeSocketResponse? Response { get; }

Property Value

IRealtimeSocketResponse

Methods

AddMessageReceivedHandler(MessageEventHandler)

Adds a listener to be notified when a message is received.

public void AddMessageReceivedHandler(IRealtimePush<RealtimeChannel, SocketResponse>.MessageEventHandler handler)

Parameters

handler IRealtimePush<RealtimeChannel, SocketResponse>.MessageEventHandler

ClearMessageReceivedHandler()

Clears all of the listeners from receiving event state changes.

public void ClearMessageReceivedHandler()

RemoveMessageReceivedHandler(MessageEventHandler)

Removes a specified listener from messages received.

public void RemoveMessageReceivedHandler(IRealtimePush<RealtimeChannel, SocketResponse>.MessageEventHandler handler)

Parameters

handler IRealtimePush<RealtimeChannel, SocketResponse>.MessageEventHandler

Resend(int)

Resends a Push request.

public void Resend(int timeoutMs = 10000)

Parameters

timeoutMs int

Send()

Sends a Push request and initializes the Timeout.

Events

OnTimeout

Invoked when this Push has not been responded to within the timeout interval.

public event EventHandler? OnTimeout

Event Type

EventHandler