Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 3.61 KB

proximitydevice_publishmessage_1989900324.md

File metadata and controls

61 lines (38 loc) · 3.61 KB
-api-id -api-type -api-device-family-note
M:Windows.Networking.Proximity.ProximityDevice.PublishMessage(System.String,System.String,Windows.Networking.Proximity.MessageTransmittedHandler)
winrt method
xbox

Windows.Networking.Proximity.ProximityDevice.PublishMessage

-description

Publishes a message to subscribers of the specified message type. The specified handler is called when the message has been transmitted.

-parameters

-param messageType

The type of message to deliver to subscribers.

-param message

The message to deliver to subscribers.

-param messageTransmittedHandler

The handler to call when the message has been transmitted.

-returns

A unique publication ID for the published message.

-remarks

You can subscribe to published messages by using the SubscribeForMessage method.

Messages continue to be published until the StopPublishingMessage method is called or the ProximityDevice object is released.

Messages are delivered to all applications that have subscribed to the message type (as indicated by the messageType parameter). Message type values are case-sensitive strings that consist of two parts: the protocol and the subtype. The protocol is first, followed by a dot (.) and then the subtype. For the PublishMessage method, the protocol must always be "Windows.". The subtype is a string of alphanumeric characters and the following additional characters: . ( ) + , - : = @ ; $ _ ! * '. The subtype cannot exceed a length of 250 characters.

To publish messages by using another message type, like "WindowsMime." or "NDEF:WriteTag", you must use the PublishBinaryMessage method.

You can use the PublishUriMessage method to publish a Uniform Resource Identifier (URI) to a proximate computer.

Messages are converted to UTF-8 characters before they're transmitted.

For UWP apps, publications and subscriptions are active only if the calling app is in the foreground.

Important

The proximity APIs do not provide authentication, encryption, or message integrity. Do not use proximity to exchange user sensitive information such as passwords, financial data, text messages, email, photographs, or government id numbers.

-examples

[!code-csharpPublishSubscribe2]

[!code-vbPublishSubscribe2]

-see-also

PublishMessage(String, String), PublishBinaryMessage, PublishUriMessage, StopPublishingMessage, Proximity and Tapping (C#/VB/C++), Proximity sample

-capabilities

proximity ID_CAP_PROXIMITY [Windows Phone], ID_CAP_PROXIMITY [Windows Phone]