/* * IMPLEMENTATION */ public Task ProcessWebSocketRequestAsync(WebSocket webSocket) { if (webSocket == null) { throw new ArgumentNullException("webSocket"); } byte[] buffer = new byte[_receiveLoopBufferSize]; return(ProcessWebSocketRequestAsync(webSocket, () => WebSocketMessageReader.ReadMessageAsync(webSocket, buffer, MaxIncomingMessageSize))); }
internal Task ProcessWebSocketRequestAsync(WebSocket webSocket, CancellationToken disconnectToken) { if (webSocket == null) { throw new ArgumentNullException("webSocket"); } var receiveContext = new ReceiveContext(webSocket, disconnectToken, MaxIncomingMessageSize, _receiveLoopBufferSize); return(ProcessWebSocketRequestAsync(webSocket, disconnectToken, state => { var context = (ReceiveContext)state; return WebSocketMessageReader.ReadMessageAsync(context.WebSocket, context.BufferSize, context.MaxIncomingMessageSize, context.DisconnectToken); }, receiveContext)); }