Dela via


StreamWebSocketControl.SupportedProtocols Property

Definition

Gets 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.

public:
 property IVector<Platform::String ^> ^ SupportedProtocols { IVector<Platform::String ^> ^ get(); };
IVector<winrt::hstring> SupportedProtocols();
public IList<string> SupportedProtocols { get; }
var iVector = streamWebSocketControl.supportedProtocols;
Public ReadOnly Property SupportedProtocols As IList(Of String)

Property Value

IVector<String>

IList<String>

IVector<Platform::String>

IVector<winrt::hstring>

A collection that contains the WebSocket sub-protocols supported by the StreamWebSocket object.

Implements

Remarks

The SupportedProtocols property contains a collection of WebSocket sub-protocols supported by the StreamWebSocket object. Before calling the ConnectAsync method, additional supported sub-protocol strings can be added to this collection, which will be sent to the server in the "Sec-WebSocket-Protocol" header during the WebSocket handshake. The protocol chosen by the WebSocket server will then be exposed on the Protocol property.

An attempt to add a sub-protocol to this collection after a successful call to ConnectAsync method will not result in an error but the new value is ignored. However, if the ConnectAsync method call or the connect operation completes with an error, an app can update the collection stored in the SupportedProtocols property and retry the ConnectAsync method call and the new value will be applied.

Applies to

See also