public Task AcceptWebSocketRequest(Func <IWebSocket, Task> callback)
        {
            var accept = Get <Action <IDictionary <string, object>, WebSocketFunc> >(OwinConstants.WebSocketAccept);

            if (accept == null)
            {
                return(TaskAsyncHelper.FromError(new InvalidOperationException("Not a web socket request")));
            }

            var options = new Dictionary <string, object>();
            var worker  = new ServerRequestWebSocket(callback);

            accept(options, worker.Invoke);
            return(TaskAsyncHelper.Empty);
        }
Exemple #2
0
        public Task AcceptWebSocketRequest(Func<IWebSocket, Task> callback)
        {
            var accept = Get<Action<IDictionary<string, object>, WebSocketFunc>>(OwinConstants.WebSocketAccept);
            if (accept == null)
            {
                return TaskAsyncHelper.FromError(new InvalidOperationException("Not a web socket request"));
            }

            var options = new Dictionary<string, object>();
            var worker = new ServerRequestWebSocket(callback);
            accept(options, worker.Invoke);
            return TaskAsyncHelper.Empty;
        }