WebSocketManager Class

Manages the establishment of WebSocket connections for a specific HTTP request.

Namespace
Microsoft.AspNetCore.Http
Assemblies
  • Microsoft.AspNetCore.Http.Abstractions

Syntax

public abstract class WebSocketManager
class Microsoft.AspNetCore.Http.WebSocketManager

Methods

AcceptWebSocketAsync()

Transitions the request to a WebSocket connection.

Return type:System.Threading.Tasks.Task<System.Net.WebSockets.WebSocket>
Returns:A task representing the completion of the transition.
public virtual Task<WebSocket> AcceptWebSocketAsync()
AcceptWebSocketAsync(System.String)

Transitions the request to a WebSocket connection using the specified sub-protocol.

Arguments:subProtocol (System.String) – The sub-protocol to use.
Return type:System.Threading.Tasks.Task<System.Net.WebSockets.WebSocket>
Returns:A task representing the completion of the transition.
public abstract Task<WebSocket> AcceptWebSocketAsync(string subProtocol)

Properties

Microsoft.AspNetCore.Http.WebSocketManager.IsWebSocketRequest

Gets a value indicating whether the request is a WebSocket establishment request.

Return type:System.Boolean
public abstract bool IsWebSocketRequest { get; }
Microsoft.AspNetCore.Http.WebSocketManager.WebSocketRequestedProtocols

Gets the list of requested WebSocket sub-protocols.

Return type:System.Collections.Generic.IList<System.String>
public abstract IList<string> WebSocketRequestedProtocols { get; }