@@ -97,6 +97,17 @@ typedef bool(aws_websocket_on_incoming_frame_begin_fn)(
9797 * Payload data will not be valid after this call, so copy if necessary.
9898 * The payload data is always unmasked at this point.
9999 *
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+ *
100111 * Return true to proceed normally. If false is returned, the websocket will read no further data,
101112 * the frame will complete with an error-code, and the connection will close.
102113 */
@@ -186,8 +197,8 @@ struct aws_websocket_client_connection_options {
186197 struct aws_http_message * handshake_request ;
187198
188199 /**
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 .
191202 * Set to 0 to prevent any incoming websocket frames until aws_websocket_increment_read_window() is called.
192203 */
193204 size_t initial_window_size ;
@@ -241,11 +252,17 @@ struct aws_websocket_client_connection_options {
241252 /**
242253 * Set to true to manually manage the read window size.
243254 *
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 .
245256 *
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).
249266 */
250267 bool manual_window_management ;
251268
@@ -390,10 +407,21 @@ AWS_HTTP_API
390407int aws_websocket_send_frame (struct aws_websocket * websocket , const struct aws_websocket_send_frame_options * options );
391408
392409/**
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+ *
397425 * This function may be called from any thread.
398426 */
399427AWS_HTTP_API
0 commit comments