1

I'm using OkHttp's Call#enqueue to issue a couple dozen HTTP requests in parallel. In my callback, I'm given an Response with a ResponseBody. Because I have several requests in flight, I'd like to read data from the ResponseBody's source() without blocking. Is there some way to do that?

For example, if suppose there are 324 bytes available in a given ResponseBody, is there some way to read those bytes and then wait asynchronously for more data to be available (potentially reading data from other ResponseBody objects for other in-flight requests in the interim)?

1 Answers1

0

Nope! OkHttp doesn't yet offer anything that flexible. You might want to look at Parallel Universe, which has hooked up OkHttp to fibers.

Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128