Export (0) Print
Expand All
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.

MessageWebSocketControl class

Applies to Windows and Windows Phone

Provides socket control data on a MessageWebSocket.

Syntax


var messageWebSocketControl = MessageWebSocket.Control;

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

The MessageWebSocketControl class provides access to advanced socket control data on a MessageWebSocket object.

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

The SupportedProtocols property gets the value of this property and can be called at any time.

The MessageType property can be changed at any time before or after the MessageWebSocket is connected. This allows an app to switch between binary and UTF-8 messages when needed.

The OutboundBufferSizeInBytes property must be set before the MessageWebSocket is connected. Setting this property after the MessageWebSocket is connected has no effect.

Any changes to the other property values on the MessageWebSocketControl must be set before the DatagramSocket is bound or connected. As a result if you need to make changes to the MaxMessageSize, ProxyCredential, OutboundBufferSizeInBytes, or ServerCredential properties, then these changes must occur before a successful call to the ConnectAsync method on the MessageWebSocket.

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.


For more information on using MessageWebSocketControl, see How to use advanced WebSocket controls (HTML) and How to use advanced WebSocket controls (XAML).

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

Other resources
How to use advanced WebSocket controls (HTML)
How to use advanced WebSocket controls (XAML)
Reference
MessageWebSocket
MessageWebSocket.Control
MessageWebSocketInformation
Samples
Connecting with WebSockets sample

 

 

Show:
© 2014 Microsoft