HttpContext.AcceptWebSocketRequest 方法
定义
接受 AspNetWebSocket 请求。Accepts an AspNetWebSocket request.
重载
AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>) |
接受一个使用指定用户函数的 AspNetWebSocket 请求。Accepts an AspNetWebSocket request using the specified user function. |
AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>, AspNetWebSocketOptions) |
接受一个使用指定用户函数和选项对象 AspNetWebSocket 请求。Accepts an AspNetWebSocket request using the specified user function and options object. |
AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>)
接受一个使用指定用户函数的 AspNetWebSocket 请求。Accepts an AspNetWebSocket request using the specified user function.
public:
void AcceptWebSocketRequest(Func<System::Web::WebSockets::AspNetWebSocketContext ^, System::Threading::Tasks::Task ^> ^ userFunc);
public void AcceptWebSocketRequest (Func<System.Web.WebSockets.AspNetWebSocketContext,System.Threading.Tasks.Task> userFunc);
member this.AcceptWebSocketRequest : Func<System.Web.WebSockets.AspNetWebSocketContext, System.Threading.Tasks.Task> -> unit
Public Sub AcceptWebSocketRequest (userFunc As Func(Of AspNetWebSocketContext, Task))
参数
- userFunc
- Func<AspNetWebSocketContext,Task>
用户函数。The user function.
例外
userFunc
参数为 null
。The userFunc
parameter is null
.
该请求不是一个AspNetWebSocket 请求。The request is not an AspNetWebSocket request.
注解
调用此方法等效于调用 AcceptWebSocketRequest 方法重载并 null
为 options
参数传递。Calling this method is equivalent to calling the AcceptWebSocketRequest method overload and passing null
for the options
parameter.
适用于
AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>, AspNetWebSocketOptions)
接受一个使用指定用户函数和选项对象 AspNetWebSocket 请求。Accepts an AspNetWebSocket request using the specified user function and options object.
public:
void AcceptWebSocketRequest(Func<System::Web::WebSockets::AspNetWebSocketContext ^, System::Threading::Tasks::Task ^> ^ userFunc, System::Web::WebSockets::AspNetWebSocketOptions ^ options);
public void AcceptWebSocketRequest (Func<System.Web.WebSockets.AspNetWebSocketContext,System.Threading.Tasks.Task> userFunc, System.Web.WebSockets.AspNetWebSocketOptions options);
member this.AcceptWebSocketRequest : Func<System.Web.WebSockets.AspNetWebSocketContext, System.Threading.Tasks.Task> * System.Web.WebSockets.AspNetWebSocketOptions -> unit
Public Sub AcceptWebSocketRequest (userFunc As Func(Of AspNetWebSocketContext, Task), options As AspNetWebSocketOptions)
参数
- userFunc
- Func<AspNetWebSocketContext,Task>
用户函数。The user function.
- options
- AspNetWebSocketOptions
选项对象。The options object.
例外
userFunc
参数为 null
。The userFunc
parameter is null
.
该请求不是一个AspNetWebSocket 请求。The request is not an AspNetWebSocket request.