Dela via


AppServiceConnection Class

Definition

Represents a connection to the endpoint for an app service. App services enable app-to-app communication by allowing you to provide services from your Universal Windows app to other Universal Windows app. The AppService provider receives the connection request as part of their background task; see AppServiceTriggerDetails class for details.

public ref class AppServiceConnection sealed : IClosable
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AppServiceConnection final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class AppServiceConnection final : IClosable
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AppServiceConnection : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class AppServiceConnection : System.IDisposable
function AppServiceConnection()
Public NotInheritable Class AppServiceConnection
Implements IDisposable
Inheritance
Object Platform::Object IInspectable AppServiceConnection
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Version history

Windows version SDK version Value added
1607 14393 OpenRemoteAsync
1607 14393 User
1903 18362 SendStatelessMessageAsync

Constructors

AppServiceConnection()

Creates and initializes a new instance of the AppServiceConnection class.

Properties

AppServiceName

Gets or sets the name of the app service to which you want to connect.

PackageFamilyName

Gets or sets the package family name for the package that contains the endpoint for the app service.

User

Gets/sets the user context. This property returns null if the caller did not specify a user.

Methods

Close()

Closes the connection to the app service.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

OpenAsync()

Opens a connection to the endpoint for the app service.

OpenRemoteAsync(RemoteSystemConnectionRequest)

Opens a connection to the endpoint on another device for the app service.

SendMessageAsync(ValueSet)

Sends a message to the other endpoint of the app service connection.

SendStatelessMessageAsync(AppServiceConnection, RemoteSystemConnectionRequest, ValueSet)

Opens an app service connection, sends a single message, waits for a single response, and then closes the connection.

Events

RequestReceived

Occurs when a message arrives from the other endpoint of the app service connection.

ServiceClosed

Occurs when the other endpoint closes the connection to the app service.

Applies to

See also