Class Push
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
IRealtimeSocketchannel
RealtimeChanneleventName
stringtype
stringpayload
objecttimeoutMs
int
Properties
Channel
The associated channel.
public RealtimeChannel Channel { get; }
Property Value
EventName
The event requested.
public string EventName { get; }
Property Value
IsSent
Flag representing the sent
state of a request.
public bool IsSent { get; }
Property Value
Message
Represents the Pushed (sent) Message
public SocketRequest? Message { get; }
Property Value
Payload
Payload of data to be sent.
public object? Payload { get; }
Property Value
Ref
Ref Of this Message
public string? Ref { get; }
Property Value
Response
Accessor for the returned Socket Response
public IRealtimeSocketResponse? Response { get; }
Property Value
Methods
AddMessageReceivedHandler(MessageEventHandler)
Adds a listener to be notified when a message is received.
public void AddMessageReceivedHandler(IRealtimePush<RealtimeChannel, SocketResponse>.MessageEventHandler handler)
Parameters
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
Resend(int)
Resends a Push
request.
public void Resend(int timeoutMs = 10000)
Parameters
timeoutMs
int
Send()
Sends a Push
request and initializes the Timeout.
public void Send()
Events
OnTimeout
Invoked when this Push
has not been responded to within the timeout interval.
public event EventHandler? OnTimeout