Make HTTP request immediatly but wait for the response async

I want to make HTTP requests to some server. Such that the following holds:

  1. I want data to reach the server as soon as possible.
  2. I don’t care much about getting the response from the server quickly. Instead, I want the request to block as little as possible.

If I only cared about 1. I would do:

HTTP.post(...)

But it is blocking, so bad for 2. If I only cared about 2. I would do

@async HTTP.post(...

But the scheduler typically does not send these immediately violating 1.

How to have both, send the data immediately but wait for the response in a non-blocking way?

1 Like

I think you want HTTP.open. See Client · HTTP.jl.

1 Like