· Mar 10

Reading a chunked HTTP response in chunks

I'm trying to read the response to a long (indefinitely) running HTTP response with Transfer-Encoding: chunked. Ideally I'd be able to read the individual chunks from the response and do something with them as they arrive rather than needing to wait for the response to finish (because it never will) - ultimately I'm thinking to wrap these back up over a WebSocket connection which seems cleaner from an API perspective.

So far it looks like my options are:

  • Extend %Net.HttpRequest, override the Read method, and add support for read of individual chunks from an ongoing request (similar to what is already supported for WebSockets, but also on an HTTP 200 response with Transfer-Encoding: chunked).
  • Use TCP and reinvent all the HTTP stuff that %Net.HttpRequest makes "just work"
  • Find some existing class in IRIS that does exactly what I want (no luck yet, hence asking here)

Is this a novel problem in ObjectScript? Is there some out-of-the-box support I'm just missing?

Thanks in advance!

Product version: IRIS 2022.3
$ZV: IRIS for Windows (x86-64) 2022.3 (Build 606U) Mon Jan 30 2023 09:12:22 EST
Discussion (3)2
Log in or sign up to continue