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

Improve stream quality and big changes in how we send data #47

Merged
merged 6 commits into from
Aug 8, 2021
Merged

Conversation

qnkhuat
Copy link
Owner

@qnkhuat qnkhuat commented Aug 8, 2021

TL;DR:

  • we stream data in block( contains many write requests in one block )
  • Now users watching the stream will be delayed with the actual stream
  • Much smoother and less lagging for both streamer and viewer
  • Streamers need to upgrade to version 1.3.0 to be able to stream

Technical note

In the previous version, any single change on the streamer's terminal is sent to the viewer. There are some problems with this approach:

  • Many changes are very small ( I.e: newline ) => inefficient use of request
  • In a short period of time we have many changes => too many requests
    With this version, we send messages by block. Each block is all messages generated in a period. This block is also being gzipped before being sent. This way we have some advantages:
  • fewer requests since we send a block of data every x (3) seconds.
  • By gzipped we reduced the message's size by around 7 folds. also, gzip is very fast so it's not a problem.

But this prevents users from watching the stream in super near real-time.

But I think 3 seconds lag is fine, it's how youtube and twitch works anw.

@vercel
Copy link

vercel bot commented Aug 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/qnkhuat/tstream/BzVd83Vta3Q4wkRcbyquQb1dtSoa
✅ Preview: https://tstream-git-playback-qnkhuat.vercel.app

[Deployment for 9c50e90 canceled]

@qnkhuat
Copy link
Owner Author

qnkhuat commented Aug 8, 2021

LGTM

@qnkhuat qnkhuat merged commit 3c2a05d into main Aug 8, 2021
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

Successfully merging this pull request may close these issues.

1 participant