WebSocketMessage
Ecng.Net
Represents a WebSocket message containing an encoding and a buffer of bytes. Primary storage uses ReadOnlyMemory.
コンストラクター
WebSocketMessage
public WebSocketMessage(Encoding encoding, ReadOnlyMemory<byte> memory)
webSocketMessage = WebSocketMessage(encoding, memory)
Represents a WebSocket message containing an encoding and a buffer of bytes. Primary storage uses ReadOnlyMemory.
- encoding
- The text encoding.
- memory
- The message bytes.
プロパティ
Encoding
public Encoding Encoding { get; }
value = webSocketMessage.Encoding
Gets the encoding used to decode the message.
Memory
public ReadOnlyMemory<byte> Memory { get; }
value = webSocketMessage.Memory
Gets the message bytes as read-only memory (primary storage).
メソッド
AsObject
public object AsObject()
result = webSocketMessage.AsObject()
Deserializes the message string into a dynamic object.
戻り値: The deserialized object.
AsObject``1
public T AsObject<T>()
result = webSocketMessage.AsObject()
Deserializes the message string into an object of type .
戻り値: The deserialized object of type .
AsReader
public JsonTextReader AsReader()
result = webSocketMessage.AsReader()
Creates a JsonTextReader to read the message as JSON.
戻り値: A JsonTextReader for the message.
AsString
public string AsString()
result = webSocketMessage.AsString()
Converts the message buffer into a string using the associated encoding.
戻り値: The message as a string.