Table of Contents

Class NearbyStreamPayload

Namespace
Plugin.Maui.NearbyConnectivity
Assembly
Plugin.Maui.NearbyConnectivity.dll

Represents an inbound named byte stream, for live or unknown-length data.

[Experimental("NEARBY001", UrlFormat = "https://phunkeler.github.io/Plugin.Maui.NearbyConnectivity/docs/payloads.html#open-a-stream")]
public sealed class NearbyStreamPayload : NearbyPayload, IDisposable
Inheritance
NearbyStreamPayload
Implements
Inherited Members

Remarks

Experimental. Streams have not been tested between two devices, and their behavior and API can change in any release. Code that uses this type gets build error NEARBY001. To opt in, add NEARBY001 to NoWarn in the project file, or suppress it with #pragma warning disable NEARBY001.

Arrives through the same PayloadsAsync(CancellationToken) stream as every other payload. The remote device opened it with OpenStreamAsync(string, CancellationToken).

Constructors

NearbyStreamPayload(string, Stream)

Initializes a new instance of the NearbyStreamPayload class.

public NearbyStreamPayload(string name, Stream stream)

Parameters

name string

The name the remote device opened the stream with.

stream Stream

The readable stream.

Properties

Name

Gets the name the remote device opened the stream with.

public string Name { get; }

Property Value

string

Remote-chosen input. Display it with the same care as a display name.

Stream

Gets the readable stream.

public Stream Stream { get; }

Property Value

Stream

The stream's readable half. It ends when the remote writer disposes its own half, or when the connection drops.

Remarks

You own it. Read it to the end or dispose the payload. A stream left unread holds the connection's inbound capacity; the plugin disposes any that are still open when the connection closes, but that is a backstop rather than the plan.

See Also