@@ -97,6 +97,17 @@ typedef bool(aws_websocket_on_incoming_frame_begin_fn)(
97
97
* Payload data will not be valid after this call, so copy if necessary.
98
98
* The payload data is always unmasked at this point.
99
99
*
100
+ * NOTE: If you created the websocket with `manual_window_management` set true, you must maintain the read window.
101
+ * Whenever the read window reaches 0, you will stop receiving anything.
102
+ * The websocket's `initial_window_size` determines the starting size of the read window.
103
+ * The read window shrinks as you receive the payload from "data" frames (TEXT, BINARY, and CONTINUATION).
104
+ * Use aws_websocket_increment_read_window() to increment the window again and keep frames flowing.
105
+ * Maintain a larger window to keep up high throughput.
106
+ * You only need to worry about the payload from "data" frames.
107
+ * The websocket automatically increments the window to account for any
108
+ * other incoming bytes, including other parts of a frame (opcode, payload-length, etc)
109
+ * and the payload of other frame types (PING, PONG, CLOSE).
110
+ *
100
111
* Return true to proceed normally. If false is returned, the websocket will read no further data,
101
112
* the frame will complete with an error-code, and the connection will close.
102
113
*/
@@ -186,8 +197,8 @@ struct aws_websocket_client_connection_options {
186
197
struct aws_http_message * handshake_request ;
187
198
188
199
/**
189
- * Initial window size for websocket.
190
- * Required .
200
+ * Initial size of the websocket's read window .
201
+ * Ignored unless `manual_window_management` is true .
191
202
* Set to 0 to prevent any incoming websocket frames until aws_websocket_increment_read_window() is called.
192
203
*/
193
204
size_t initial_window_size ;
@@ -241,11 +252,17 @@ struct aws_websocket_client_connection_options {
241
252
/**
242
253
* Set to true to manually manage the read window size.
243
254
*
244
- * If this is false, the connection will maintain a constant window size .
255
+ * If this is false, no backpressure is applied and frames will arrive as fast as possible .
245
256
*
246
- * If this is true, the caller must manually increment the window size using aws_websocket_increment_read_window().
247
- * If the window is not incremented, it will shrink by the amount of payload data received. If the window size
248
- * reaches 0, no further data will be received.
257
+ * If this is true, then whenever the read window reaches 0 you will stop receiving anything.
258
+ * The websocket's `initial_window_size` determines the starting size of the read window.
259
+ * The read window shrinks as you receive the payload from "data" frames (TEXT, BINARY, and CONTINUATION).
260
+ * Use aws_websocket_increment_read_window() to increment the window again and keep frames flowing.
261
+ * Maintain a larger window to keep up high throughput.
262
+ * You only need to worry about the payload from "data" frames.
263
+ * The websocket automatically increments the window to account for any
264
+ * other incoming bytes, including other parts of a frame (opcode, payload-length, etc)
265
+ * and the payload of other frame types (PING, PONG, CLOSE).
249
266
*/
250
267
bool manual_window_management ;
251
268
@@ -390,10 +407,21 @@ AWS_HTTP_API
390
407
int aws_websocket_send_frame (struct aws_websocket * websocket , const struct aws_websocket_send_frame_options * options );
391
408
392
409
/**
393
- * Manually increment the read window.
394
- * The read window shrinks as payload data is received, and reading stops when its size reaches 0.
395
- * Note that the read window can also be controlled from the aws_websocket_on_incoming_frame_payload_fn(),
396
- * callback, by manipulating the `out_increment_window` argument.
410
+ * Manually increment the read window to keep frames flowing.
411
+ *
412
+ * If the websocket was created with `manual_window_management` set true,
413
+ * then whenever the read window reaches 0 you will stop receiving data.
414
+ * The websocket's `initial_window_size` determines the starting size of the read window.
415
+ * The read window shrinks as you receive the payload from "data" frames (TEXT, BINARY, and CONTINUATION).
416
+ * Use aws_websocket_increment_read_window() to increment the window again and keep frames flowing.
417
+ * Maintain a larger window to keep up high throughput.
418
+ * You only need to worry about the payload from "data" frames.
419
+ * The websocket automatically increments the window to account for any
420
+ * other incoming bytes, including other parts of a frame (opcode, payload-length, etc)
421
+ * and the payload of other frame types (PING, PONG, CLOSE).
422
+ *
423
+ * If the websocket was created with `manual_window_management` set false, this function does nothing.
424
+ *
397
425
* This function may be called from any thread.
398
426
*/
399
427
AWS_HTTP_API
0 commit comments