Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebSocketKeepAlive class

Provides the ability to send a WebSocket protocol keep-alive on a connected WebSocket.

Syntax


Public NotInheritable Class WebSocketKeepAlive
    Implements IBackgroundTask

Members

The WebSocketKeepAlive class has these types of members:

Constructors

The WebSocketKeepAlive class has these constructors.

ConstructorDescription
WebSocketKeepAlive Creates a new WebSocketKeepAlive object.

 

Methods

The WebSocketKeepAlive class has these methods. It also inherits methods from the Object class.

MethodDescription
Run Sends a WebSocket protocol keep-alive on a connected WebSocket.

 

Remarks

The WebSocketKeepAlive class is used in conjunction with the ControlChannelTrigger class and related interfaces to enable real-time network status and triggers for the StreamWebSocket and MessageWebSocket classes. Control channel triggers are used by long-running network apps to minimize network and system resource usage. Network triggers allow an app to drop to a low-power mode for periods of time while still keeping established network connections intact but in a low-power state. An app can set a keep-alive trigger used by the system for when the app should wake up and send a WebSocket keep-alive packet.

A Windows Store app is normally suspended when it is no longer in the foreground. There are some exceptions where an app should not be suspended (actively printing, accessing an audio stream, and transferring files in the background, for example). The ControlChannelTrigger class allows a network app that has established a WebSocket connection to notify the system that the network connection should be kept operational and that the system should wake up the suspended app when network data is received for the app or to send a WebSocket keep-alive packet.

WebSocketKeepAlive is used as the TaskEntryPoint for a keep-alive in ControlChannelTrigger. A developer will need to write code to handle receiving data.

For more information about suspending and waking up an app, How to set background connectivity options.

For more information on the WebSocket keep-alive control frames, see the WebSocket Protocol.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

See also

Object
IBackgroundTask

 

 

Show: