Skip to content

Conversation

@graebm
Copy link
Contributor

@graebm graebm commented Dec 15, 2022

Description of changes:

  • disabling backpressure on the websocket, disables it on the whole channel
    • (previously, we kept backpressure on, and just automatically maintained a constant window size)
  • change it so that window-size is only affected by "data" frames (TEXT, BINARY, CONTINUATION) and not "control" frames (PING, PONG, CLOSE).
    • This is how HTTP/2 does it.
    • If a user is doing careful flow-control stuff, they'll only be doing it with "data" frames.
  • add copious documentation, because this stuff is confusing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

Codecov Report

Base: 79.24% // Head: 79.19% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (1c5deb3) compared to base (642d877).
Patch coverage: 30.76% of modified lines in pull request are covered.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           websocket-changes     #407      +/-   ##
=====================================================
- Coverage              79.24%   79.19%   -0.06%     
=====================================================
  Files                     27       27              
  Lines                  11752    11761       +9     
=====================================================
+ Hits                    9313     9314       +1     
- Misses                  2439     2447       +8     
Impacted Files Coverage Δ
source/websocket_bootstrap.c 84.61% <14.28%> (-2.58%) ⬇️
source/websocket.c 81.94% <50.00%> (-0.33%) ⬇️
source/hpack_huffman_static.c 34.13% <0.00%> (-0.16%) ⬇️
source/connection_manager.c 88.21% <0.00%> (+0.57%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@graebm graebm marked this pull request as ready for review December 15, 2022 00:27
Copy link
Contributor

@TingDaoK TingDaoK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just trivial stuff.

* Required.
* Initial size of the websocket's read window.
* Ignored unless `manual_window_management` is true.
* Set to 0 to prevent any incoming websocket frames until aws_websocket_increment_read_window() is called.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever the read window reaches 0, you will stop receiving data.

Set to 0 to prevent any incoming websocket frames until aws_websocket_increment_read_window() is called.

So, the window is for "data" frames only, but if it reaches to 0, will "control" frames be affected?
I think PING/PONG and CLOSE should not be affected? But, as we use tcp window, maybe we are not able to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the window gets to 0, everything stops

I updated the comments to elaborate how the websocket still auto-increments when it gets any other types of bytes, but once you hit 0, everything stops

* The payload data is always unmasked at this point.
*
* NOTE: If you created the websocket with `manual_window_management` set true, you must maintain the read window.
* Whenever the read window reaches 0, you will stop receiving data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will stop receiving data

Data here is unclear to me. Like only data frame, or all possible data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully more clear now?

@graebm graebm changed the base branch from websocket-changes to main December 20, 2022 01:50
@graebm graebm merged commit f19e8e2 into main Dec 20, 2022
@graebm graebm deleted the ws-backpressure branch December 20, 2022 17:15
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.

3 participants