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

Support for readable streams in CompanionHTTPResponse body #110

Open
JaaHann opened this issue Dec 26, 2024 · 1 comment
Open

Support for readable streams in CompanionHTTPResponse body #110

JaaHann opened this issue Dec 26, 2024 · 1 comment

Comments

@JaaHann
Copy link

JaaHann commented Dec 26, 2024

I would like to request support for readable streams in CompanionHTTPResponse body.

After testing, the response body only contains the stream-object serialized to JSON (using Companion v3.4.3 & @companion-module/base v1.11.0).
Instead, I would like the stream-data to be piped into the response.
So some kind of alternative handling of responses with readable streams would be highly appreciated.

I have some use cases where I want to return certain data via "handleHttpRequest(request)" that I first need to get elsewhere - but this can take a moment sometimes.
For now, I return a ticket/id in the response to do interval-polling to get available data chunks assigned to that ticket/id, until a “completed” response is being received.

Of course I thought about websockets and even tested with webRTC data-channels. But I think readable streams via the already existing webserver of companion would be more suitable for this job.

@Julusian
Copy link
Member

I am open to this, but it won't be particularly simple to achieve.

In between the module and the http server in companion is a layer of communication done over ipc. In the future, this could become some kind of tcp based protocol instead.
Meaning that to support this we would need to figure out a way of encoding this stream over this ipc/tcp, and implement it.

Perhaps this would be mitigated if the 5s timeout we currently impose on handleHttpRequest was higher, or could be configured in some way, or perhaps the module could inform companion on an interval 'Im still working on this'?

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

No branches or pull requests

2 participants