Class NearbyInboundPayload
- Namespace
- Plugin.Maui.NearbyConnectivity
- Assembly
- Plugin.Maui.NearbyConnectivity.dll
A payload that arrived from a nearby device, together with the device that sent it.
public sealed record NearbyInboundPayload : IEquatable<NearbyInboundPayload>
- Inheritance
-
NearbyInboundPayload
- Implements
- Inherited Members
Remarks
What PayloadsAsync(CancellationToken) yields. One merged loop serves every peer, so each payload has to say who sent it. Reaching back to a connection to ask is exactly the per-connection bookkeeping that stream exists to remove.
Both members are always present. The sender is part of what it means to receive something, so this type exists rather than a nullable property on NearbyPayload itself: a payload an application constructed has no sender, and making every read site prove that at the point of use is a cost paid for a case the receive loop never sees.
A class rather than a record struct, so there is no default instance carrying a
null device and a null payload. The API has no way to produce one, and a caller
deconstructing what this stream yields never has to check.
Constructors
NearbyInboundPayload(NearbyDevice, NearbyPayload)
A payload that arrived from a nearby device, together with the device that sent it.
public NearbyInboundPayload(NearbyDevice RemoteDevice, NearbyPayload Payload)
Parameters
RemoteDeviceNearbyDeviceThe device that sent the payload, the same immutable snapshot RemoteDevice carries. Its data is frozen at the moment the connection opened, while its verbs (ConnectAsync(CancellationToken), Connection) resolve against the session when called.
PayloadNearbyPayloadWhat arrived. Pattern-match it: NearbyBytesPayload, NearbyFilePayload, or NearbyStreamPayload, the closed set.
Remarks
What PayloadsAsync(CancellationToken) yields. One merged loop serves every peer, so each payload has to say who sent it. Reaching back to a connection to ask is exactly the per-connection bookkeeping that stream exists to remove.
Both members are always present. The sender is part of what it means to receive something, so this type exists rather than a nullable property on NearbyPayload itself: a payload an application constructed has no sender, and making every read site prove that at the point of use is a cost paid for a case the receive loop never sees.
A class rather than a record struct, so there is no default instance carrying a
null device and a null payload. The API has no way to produce one, and a caller
deconstructing what this stream yields never has to check.
- See Also
Properties
Payload
What arrived. Pattern-match it: NearbyBytesPayload, NearbyFilePayload, or NearbyStreamPayload, the closed set.
public NearbyPayload Payload { get; init; }
Property Value
RemoteDevice
The device that sent the payload, the same immutable snapshot RemoteDevice carries. Its data is frozen at the moment the connection opened, while its verbs (ConnectAsync(CancellationToken), Connection) resolve against the session when called.
public NearbyDevice RemoteDevice { get; init; }