Class WebSocketMessage
- Namespace
- Cratis.Arc.Queries
- Assembly
- Cratis.Arc.Core.dll
Represents a WebSocket message envelope.
public class WebSocketMessage
- Inheritance
-
WebSocketMessage
- Inherited Members
- Extension Methods
Constructors
WebSocketMessage()
public WebSocketMessage()
Properties
Data
Gets or sets the payload data (for data messages).
public object? Data { get; set; }
Property Value
Timestamp
Gets or sets the timestamp when the message was sent (for ping/pong latency tracking).
public long? Timestamp { get; set; }
Property Value
- long?
Type
Gets or sets the type of message.
[JsonConverter(typeof(JsonStringEnumConverter<WebSocketMessageType>))]
public WebSocketMessageType Type { get; set; }
Property Value
Methods
CreateData(object)
Creates a data message.
public static WebSocketMessage CreateData(object data)
Parameters
dataobjectThe data payload.
Returns
- WebSocketMessage
A data WebSocketMessage.
Ping(long)
Creates a ping message.
public static WebSocketMessage Ping(long timestamp)
Parameters
timestamplongThe timestamp when the ping was sent.
Returns
- WebSocketMessage
A ping WebSocketMessage.
Pong(long)
Creates a pong message.
public static WebSocketMessage Pong(long timestamp)
Parameters
timestamplongThe timestamp from the original ping.
Returns
- WebSocketMessage
A pong WebSocketMessage.