MessageWebSocketControl 클래스

정의

MessageWebSocket에 소켓 제어 데이터를 제공합니다.

public ref class MessageWebSocketControl sealed
public ref class MessageWebSocketControl sealed : IWebSocketControl2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class MessageWebSocketControl final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class MessageWebSocketControl final : IWebSocketControl2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class MessageWebSocketControl
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class MessageWebSocketControl : IWebSocketControl2
Public NotInheritable Class MessageWebSocketControl
Public NotInheritable Class MessageWebSocketControl
Implements IWebSocketControl2
상속
Object Platform::Object IInspectable MessageWebSocketControl
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

설명

MessageWebSocketControl 클래스는 MessageWebSocket 개체의 고급 소켓 제어 데이터에 대한 액세스를 제공합니다.

MessageWebSocketControl 개체는 부모 MessageWebSocket 개체를 사용하여 자동으로 만들어집니다. MessageWebSocket.Control 속성은 연결된 MessageWebSocket 개체에 대한 액세스를 제공합니다.

SupportedProtocols 속성은 이 속성의 값을 가져오며 언제든지 호출할 수 있습니다.

MessageType 속성은 MessageWebSocket이 연결되기 전이나 후에 언제든지 변경할 수 있습니다. 이렇게 하면 필요할 때 앱이 이진 메시지와 UTF-8 메시지 간에 전환할 수 있습니다.

MessageWebSocket이 연결되기 전에 OutboundBufferSizeInBytes 속성을 설정해야 합니다. MessageWebSocket이 연결된 후에 이 속성을 설정해도 효과가 없습니다.

DatagramSocket이 바인딩되거나 연결되기 전에 MessageWebSocketControl의 다른 속성 값에 대한 변경 내용을 설정해야 합니다. 따라서 MaxMessageSize, ProxyCredential, OutboundBufferSizeInBytes 또는 ServerCredential 속성을 변경해야 하는 경우 MessageWebSocket에서 ConnectAsync 메서드를 성공적으로 호출하기 전에 이러한 변경 내용이 발생해야 합니다.

다음 예제에서는 MessageWebSocket을 만든 다음 MessageWebSocketControl.MessageType 속성을 이진으로 설정하는 방법을 보여 줍니다. (다른 속성도 비슷한 방식으로 설정할 수 있습니다.) 이 작업이 완료되면 앱에서 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.
#include <winrt/Windows.Networking.Sockets.h>
using namespace winrt;
...
Windows::Networking::Sockets::MessageWebSocket clientSocket;

// Get the current setting for this option.
// This isn't required, but it shows how to get the current setting.
auto currentSetting{ clientSocket.Control().MessageType() };

// Set QualityOfService to Binary.
clientSocket.Control().MessageType(Windows::Networking::Sockets::SocketMessageType::Binary);

// Now you can call the ConnectAsync function 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.

MessageWebSocketControl 사용에 대한 자세한 내용은 고급 WebSocket 컨트롤을 사용하는 방법을 참조하세요.

버전 기록

Windows 버전 SDK 버전 추가된 값
1607 14393 IgnorableServerCertificateErrors
1709 16299 ActualUnsolicitedPongInterval
1709 16299 ClientCertificate
1709 16299 DesiredUnsolicitedPongInterval
1709 16299 ReceiveMode

속성

ActualUnsolicitedPongInterval

앱에서 실제 원치 않는 WebSocket PONG 간격을 가져올 수 있습니다.

ClientCertificate

보안 WebSocket 연결이 설정된 경우 클라이언트에서 제공하는 인증서를 가져옵니다.

DesiredUnsolicitedPongInterval

앱에서 원치 않는 WebSocket PONG 간격을 가져와서 설정할 수 있습니다.

IgnorableServerCertificateErrors

무시 가능한 서버 인증서 오류 목록을 가져옵니다. 이 목록을 가져와서 보안 WebSocket(wss:// 프로토콜) 서버 인증서 유효성 검사 프로세스 중에 무시하려는 서버 인증서 오류에 대한 ChainValidationResult 값을 추가합니다.

MaxMessageSize

MessageWebSocket 개체에 구성될 WebSocket 메시지의 최대 메시지 크기(바이트)입니다.

MessageType

쓰기 작업을 위해 MessageWebSocket 개체에 구성할 WebSocket 메시지 유형입니다.

OutboundBufferSizeInBytes

MessageWebSocket 개체에서 데이터를 보내는 데 사용할 송신 버퍼의 크기(바이트)입니다.

ProxyCredential

MessageWebSocket 개체를 사용하여 HTTP 헤더 인증을 통해 프록시 서버에 인증하는 데 사용할 자격 증명입니다.

ReceiveMode

클라이언트가 전체 메시지 또는 부분 메시지 수신을 제어할 수 있습니다.

ServerCredential

MessageWebSocket 개체를 사용하여 HTTP 헤더 인증을 통해 WebSocket 서버에 인증하는 데 사용할 자격 증명입니다.

SupportedProtocols

연결 핸드셰이크 중에 서버에 보급될 지원되는 하위 프로토콜 목록을 추가하는 데 사용할 수 있는 컬렉션을 가져옵니다.

적용 대상

추가 정보