Sitelet https://web.archive.org/web/20201007203544/https://github.com/fhessel/esp32_https_server/issues/47
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel communication #47

Open
r-zlotorzynski opened this issue Aug 1, 2019 · 1 comment
Open

Parallel communication #47

r-zlotorzynski opened this issue Aug 1, 2019 · 1 comment
Labels

Comments

@r-zlotorzynski
Copy link

@r-zlotorzynski r-zlotorzynski commented Aug 1, 2019

I'm using a sample file in the Examples/Async-Server directory.

I need to send very large response files.

Currently, communication looks like this:

  1. receiving the request from the client 1
  2. sending a response to the client 1
  3. receiving the request from the client 2
  4. sending a response to the client 2
    ... etc.

So customer 2 has to wait until client 1 gets the whole answer. I want to avoid it.

And I would like to handle all requests in parallel:

  1. receiving the request from the client 1
  2. sending a first packet response to the client 1
  3. receiving the request from the client 2
  4. sending a first packet response to the client 2
  5. sending a next packet response to the client 1
  6. sending a next packet response to the client 2
    ... etc. every loop

Is it possible? How can I do this?

@fhessel
Copy link
Owner

@fhessel fhessel commented Aug 3, 2019

At the moment that's not possible, as the handler function would need to tell the server that the request is only processed partially. I assume that it's possible, but it would need some major changes to how HTTPConnection handles the requests.

The only thing that the ASync-Server example can provide is that your regular loop() code would run during long requests, if the handler function blocks (e.g. due to waiting for I/O).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.