Class IncomingMessage
- Namespace
- WebDriverBiDi.Protocol
- Assembly
- WebDriverBiDi.dll
Represents a message being received over the wire from the WebDriverBiDi protocol.
public class IncomingMessage : IDisposable
- Inheritance
-
IncomingMessage
- Implements
- Inherited Members
Constructors
IncomingMessage(IMemoryOwner<byte>, int, Func<JsonDocument, JsonDocument?>?)
Initializes a new instance of the IncomingMessage class.
public IncomingMessage(IMemoryOwner<byte> owner, int length, Func<JsonDocument, JsonDocument?>? documentTransformer = null)
Parameters
ownerIMemoryOwner<byte>The IMemoryOwner<T> whose Memory contains the incoming message bytes. This instance takes ownership and will dispose it on disposal.
lengthintThe length, in bytes, of the incoming message within the owner's buffer.
documentTransformerFunc<JsonDocument, JsonDocument>An optional transforming function that converts the parsed JsonDocument to another, or returns null to indicate the message should be silently discarded. The function may return the document it was given unchanged. The function does not take ownership of the document it is given and must not keep a reference to it: this message disposes that document when the function returns null, returns a different document, or throws. A document the function returns becomes owned by this message and is disposed when the message is disposed. An exception thrown by the function propagates from Parse().
Properties
MessageData
Gets the raw data of the incoming message as a read-only slice of the owner's buffer.
public ReadOnlyMemory<byte> MessageData { get; }
Property Value
MessageKind
Gets the kind of incoming message. Returns Uninitialized if the message has not been deserialized by the JSON parser.
public IncomingMessageKind MessageKind { get; }
Property Value
MessageLength
Gets the length, in bytes, of the incoming message.
public int MessageLength { get; }
Property Value
MessageText
Gets the content of the incoming message as a UTF-8 string.
public string MessageText { get; }
Property Value
Methods
Dispose()
Releases resources used by this IncomingMessage.
public void Dispose()
Parse()
Parses the incoming message data as a JSON document.
public virtual void Parse()