Share via


MessageWebSocketControl.MessageType Property

Definition

The WebSocket message type to be configured on a MessageWebSocket object for write operations.

public:
 property SocketMessageType MessageType { SocketMessageType get(); void set(SocketMessageType value); };
SocketMessageType MessageType();

void MessageType(SocketMessageType value);
public SocketMessageType MessageType { get; set; }
var socketMessageType = messageWebSocketControl.messageType;
messageWebSocketControl.messageType = socketMessageType;
Public Property MessageType As SocketMessageType

Property Value

The WebSocket message type. The default is binary.

Remarks

A WebSocket message on the MessageWebSocket object can be either a binary message or a UTF-8 message. The default value is SocketMessageType.Binary.

This property only affects write operations on OutputStream. It does not affect the format of received messages.

The MessageType property can be changed at any time. This allows an app to switch between binary and UTF-8 messages when needed.

Before changing the MessageType on a bound or connected MessageWebSocket, any outgoing packets should first be flushed to ensure that all previously-written data is sent out with the previous message type

Applies to

See also