Dela via


StreamWebSocket.SetRequestHeader(String, String) Method

Definition

Adds an HTTP request header to the HTTP request message used in the WebSocket protocol handshake by the StreamWebSocket object.

public:
 virtual void SetRequestHeader(Platform::String ^ headerName, Platform::String ^ headerValue) = SetRequestHeader;
void SetRequestHeader(winrt::hstring const& headerName, winrt::hstring const& headerValue);
public void SetRequestHeader(string headerName, string headerValue);
function setRequestHeader(headerName, headerValue)
Public Sub SetRequestHeader (headerName As String, headerValue As String)

Parameters

headerName
String

Platform::String

winrt::hstring

The name of the request header.

headerValue
String

Platform::String

winrt::hstring

The value of the request header.

Implements

M:Windows.Networking.Sockets.IWebSocket.SetRequestHeader(System.String,System.String) M:Windows.Networking.Sockets.IWebSocket.SetRequestHeader(Platform::String,Platform::String) M:Windows.Networking.Sockets.IWebSocket.SetRequestHeader(winrt::hstring,winrt::hstring)

Remarks

The SetRequestHeader method must be called prior to calling the ConnectAsync method. Calling the SetRequestHeader method after calling the ConnectAsync method will result in an error.

Using the SetRequestHeader method to add a Sec-WebSocket-Extensions header is not supported.

Applies to

See also