WebSocketMessage

Ecng.Net

Represents a WebSocket message containing an encoding and a buffer of bytes. Primary storage uses ReadOnlyMemory.

Construtores

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.

Propriedades

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).

Métodos

AsObject
public object AsObject()
result = webSocketMessage.AsObject()

Deserializes the message string into a dynamic object.

Retorna: The deserialized object.

AsObject``1
public T AsObject<T>()
result = webSocketMessage.AsObject()

Deserializes the message string into an object of type .

Retorna: The deserialized object of type .

AsReader
public JsonTextReader AsReader()
result = webSocketMessage.AsReader()

Creates a JsonTextReader to read the message as JSON.

Retorna: A JsonTextReader for the message.

AsString
public string AsString()
result = webSocketMessage.AsString()

Converts the message buffer into a string using the associated encoding.

Retorna: The message as a string.