Skip to content

Commit

Permalink
Fixes requested by @domenic
Browse files Browse the repository at this point in the history
  • Loading branch information
ricea committed Feb 21, 2024
1 parent b2e001c commit 1e2eae9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -991,18 +991,18 @@ and data |data|, the user agent must [=queue a global task=] on the [=WebSocket
1. [=ReadableStream/Enqueue=] |chunk| into |stream|'s [=WebSocketStream/readable stream=].
1. Apply backpressure to the WebSocket.

<p class=note>Applying backpressure <span class=allow-2119>should</span> result in no new WebSocket
messages being handled until the backpressure is released. After an implementation-defined amount
of data is buffered, the client will stop reading from the underlying network connection resulting
in network-layer backpressure being applied.
<p class=note>Applying backpressure will result in no new WebSocket messages being handled until
the backpressure is released. After an implementation-defined amount of data is buffered, the
client will stop reading from the underlying network connection resulting in network-layer
backpressure being applied.
</div>

<hr>

When [=the WebSocket closing handshake is started=] for a {{WebSocketStream}}
|stream|, the user agent must [=queue a global task=] on the [=WebSocket task source=] given
|stream|'s [=relevant global object=] to change |stream|'s [=WebSocketStream/ready state=] to
{{WebSocket/CLOSING}} if it is not already. [[!WSP]]
{{WebSocket/CLOSING}} [[!WSP]]

<hr>

Expand Down Expand Up @@ -1061,14 +1061,16 @@ To <dfn>cancel</dfn> a {{WebSocketStream}} |stream| given |reason|, [=close usin

To <dfn>write</dfn> |chunk| to a {{WebSocketStream}} |stream|:
1. Let |promise| be [=a new promise=] created in |stream|'s [=relevant realm=].
1. Let |data| be null.
1. Let |opcode| be null.
1. If |chunk| is a {{BufferSource}},
1. Let |data| be a [=get a copy of the buffer source|copy of the bytes=] given |chunk|.
1. Let |opcode| be a binary frame opcode.
1. Set |data| to a [=get a copy of the buffer source|copy of the bytes=] given |chunk|.
1. Set |opcode| to a binary frame opcode.
1. Otherwise,
1. Let |string| be the result of [=Converted to an IDL value|converting=] |chunk| to an IDL
{{USVString}}. If this throws an exception, return [=a promise rejected with=] the exception.
1. Let |data| be the result of [=UTF-8 encoding=] |string|.
1. Let |opcode| be a text frame opcode.
1. Set |data| to the result of [=UTF-8 encoding=] |string|.
1. Set |opcode| to a text frame opcode.
1. In parallel,
1. Wait until there is sufficient buffer space in |stream| to send the message.

Expand Down

0 comments on commit 1e2eae9

Please sign in to comment.