Skip to main content
MessageWebSocketControl class

Applies to Windows and Windows Phone

Provides socket control data on a MessageWebSocket.

Syntax


var messageWebSocketControl = MessageWebSocket.Control;

public sealed class MessageWebSocketControl : IWebSocketControl

Public NotInheritable Class MessageWebSocketControl
    Implements IWebSocketControl

public ref class MessageWebSocketControl sealed : IWebSocketControl

Attributes

[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Version(0x06020000)]

Members

The MessageWebSocketControl class has these types of members:

Methods

The MessageWebSocketControl class inherits methods from the Object class (C#/VB/C++).

Properties

The MessageWebSocketControl class has these properties.

PropertyAccess typeDescription

MaxMessageSize

Read/writeThe maximum message size, in bytes, for a WebSocket message to be configured on the MessageWebSocket object.

MessageType

Read/writeThe WebSocket message type to be configured on a MessageWebSocket object for write operations.

OutboundBufferSizeInBytes

Read/writeThe size, in bytes, of the send buffer to be used for sending data on a MessageWebSocket object.

ProxyCredential

Read/writeThe credential to use to authenticate to the proxy server through HTTP header authentication using a MessageWebSocket object.

ServerCredential

Read/writeThe credential to use to authenticate to the WebSocket server through HTTP header authentication using a MessageWebSocket object.

SupportedProtocols

Read-onlyGets a collection that can be used to add a list of supported sub-protocols that will be advertised to the server during the connect handshake.

 

Remarks

A MessageWebSocketControl object is automatically created with the parent MessageWebSocket object. The MessageWebSocket.Control property provides access to the associated MessageWebSocketControl object.

The following example creates a MessageWebSocket, and then demonstrates how to set the MessageWebSocketControl.MessageType property to binary. (Other properties may be set in a similar manner.) After this is done, the app can connect the MessageWebSocket.


var clientWebSocket = new Windows.Networking.Sockets.MessageWebSocket();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting
var currentSetting = clientWebSocket.control.messageType;

// Set messageType to binary 
clientWebSocket.control.messageType = Windows.Networking.Sockets.SocketMessageType.binary;
   
// Now you can call the ConnectAsync method to connect the MessageWebSocket.

using namespace Windows::Networking::Sockets;

MessageWebSocket^ clientWebSocket = ref new MessageWebSocket();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting
SocketMessageType currentSetting = clientWebSocket->Control->MessageType;

// Set messageType to binary 
clientWebSocket->Control->MessageType = SocketMessageType::Binary;

// Now you can call the ConnectAsync method to connect the MessageWebSocket.

using Windows.Networking.Sockets;

MessageWebSocket clientWebSocket = new MessageWebSocket();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting
SocketMessageType currentSetting = clientWebSocket.Control.MessageType;

// Set messageType to binary 
clientWebSocket.Control.MessageType = SocketMessageType.Binary;

// Now you can call the ConnectAsync method to connect the MessageWebSocket.

For more information about using MessageWebSocketControl, see How to use advanced WebSocket controls.

Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

DLL

Windows.Networking.dll

See also

MessageWebSocket
How to use advanced WebSocket controls