/// <summary> /// Attempts to process the command if it was received in full. /// </summary> /// <param name="data">Received from the client so far</param> /// <param name="cancellation">Cancellation token</param> /// <returns>A <see cref="Task"/> that represents an asynchronous operation.</returns> protected sealed override async Task OnData(ArrayBuffer data, CancellationToken cancellation) { if (data.EndsWith(lineFeed)) { data.TrimEnd(lineFeed.Length); LogRequest(data); var commandLength = data.CountUntil(argumentCommandSeparator); var argumentsLength = data.Length - commandLength - 1; await OnCommand( data.ToString(0, commandLength, Encoding.ASCII), argumentsLength > 0 ?data.GetView(commandLength + 1, argumentsLength) : ArrayBufferView.Empty, cancellation); data.Clear(); } }