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

Make stream size optional #334

Open
rohiievych opened this issue Jul 22, 2022 · 1 comment
Open

Make stream size optional #334

rohiievych opened this issue Jul 22, 2022 · 1 comment

Comments

@rohiievych
Copy link
Member

rohiievych commented Jul 22, 2022

Is your feature request related to a problem? Please describe.

Currently we are able to stream files, so there is a size parameter provided. Using stream size Metacom can track incoming bytes and automatically end the stream, when it's done. To cover some cases, when the stream has to be infinite (e.g. data traffic) we need to allow users create streams without required size attached and make them able to end streams by themselves.

Describe the solution you'd like

Make stream size parameter as optional.

Describe alternatives you've considered

We can collect some data in memory and stream it as a binary array with known size.

Additional context

There is a caveat when a writable stream is stopped by nodejs readable calling end() method: stream end instruction on client is received before some chunks do, what makes a situation of a race condition over websocket resulting in small data loss. This problem must be investigated to make optional stream size feature safe.
As a testable workaround we can set timeout in 100-500ms in writable end method.

@vadymshturkhal
Copy link

Problem investigated.
Writable end() works correct.
When we use transport.send with buffer and transport.send with parsed object, they are two different transport.send that work in parallel

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

No branches or pull requests

2 participants