Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-125966

QtHttpServer: Add an additional API to add a route that will be executed asynchronously and can send data back to the client in multiple parts

    XMLWordPrintable

Details

    Description

      There is an Api for adding a routes that can run  asynchronously and return a
      QFuture<QHttpServerResponse>. However that will always send the entire response back to the client when the response is finished, in the mean time the response is stored in the QHttpServerResponse object.. There is no way to send one chunk of data at a time back to the client.
       
      Add an API for responding one chunk at a time. This can be done by adding a route that takes QHttpServerRequest and a new class QAsyncHttpServerResponder as arguments.
      Like this: 

      server.route("test", [] (const int page, const QHttpServerRequest &request, QAsyncHttpServerResponder& asyncResponder) {
      QtConcurrent::run([request]()

      { asyncResponder.write(request...); }

      );
      });

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              oyheskes Øystein Heskestad
              oyheskes Øystein Heskestad
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes