MessageJsonConverter

StockSharp.Ws

Converts StockSharp messages to and from the WebSocket JSON wire format.

Methoden

Deserialize
public WsCommand Deserialize(string json)
result = messageJsonConverter.Deserialize(json)

Deserialize a JSON command from a WS client into a StockSharp Message. Never throws on malformed input: a parse failure is surfaced as a WsCommand with IsError set so the caller can reject the frame (NACK) without tearing down the loop.

json
Complete JSON command frame.

Rückgabe: The parsed command, or for an empty frame.

DeserializeMessage
public Message DeserializeMessage(string json)
result = messageJsonConverter.DeserializeMessage(json)

Deserialize a server-to-client JSON message (Level1Change, QuoteChange, Tick, Transaction, Candle, Security, etc.) back into a StockSharp Message.

json
Complete JSON message frame.

Rückgabe: The message, or for an empty frame or unknown type.

Serialize
public string Serialize(Message message)
result = messageJsonConverter.Serialize(message)

Serializes a message.

message
Message to serialize.

Rückgabe: JSON wire frame.

Serialize
public string Serialize(Message message, string direction, string sessionId)
result = messageJsonConverter.Serialize(message, direction, sessionId)

Serializes a message with relay routing metadata.

message
Message to serialize.
direction
Relay direction.
sessionId
Relay session identifier.

Rückgabe: JSON wire frame.