Skip to content

Commit 2405c17

Browse files
authored
[doc] Add punctuation for readability (#2213)
1 parent 8be840e commit 2405c17

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
1111
[client][client-report].
1212

1313
**Note**: This module does not work in the browser. The client in the docs is a
14-
reference to a back end with the role of a client in the WebSocket
15-
communication. Browser clients must use the native
14+
reference to a backend with the role of a client in the WebSocket communication.
15+
Browser clients must use the native
1616
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
1717
object. To make the same code work seamlessly on Node.js and the browser, you
1818
can use one of the many wrappers available on npm, like
@@ -87,7 +87,7 @@ npm install --save-optional utf-8-validate
8787

8888
This contains a binary polyfill for [`buffer.isUtf8()`][].
8989

90-
To force ws to not use utf-8-validate, use the
90+
To force ws not to use utf-8-validate, use the
9191
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
9292

9393
## API docs
@@ -146,7 +146,7 @@ const wss = new WebSocketServer({
146146
```
147147

148148
The client will only use the extension if it is supported and enabled on the
149-
server. To always disable the extension on the client set the
149+
server. To always disable the extension on the client, set the
150150
`perMessageDeflate` option to `false`.
151151

152152
```js
@@ -451,11 +451,11 @@ wss.on('connection', function connection(ws, req) {
451451

452452
### How to detect and close broken connections?
453453

454-
Sometimes the link between the server and the client can be interrupted in a way
455-
that keeps both the server and the client unaware of the broken state of the
454+
Sometimes, the link between the server and the client can be interrupted in a
455+
way that keeps both the server and the client unaware of the broken state of the
456456
connection (e.g. when pulling the cord).
457457

458-
In these cases ping messages can be used as a means to verify that the remote
458+
In these cases, ping messages can be used as a means to verify that the remote
459459
endpoint is still responsive.
460460

461461
```js
@@ -490,7 +490,7 @@ wss.on('close', function close() {
490490
Pong messages are automatically sent in response to ping messages as required by
491491
the spec.
492492

493-
Just like the server example above your clients might as well lose connection
493+
Just like the server example above, your clients might as well lose connection
494494
without knowing it. You might want to add a ping listener on your clients to
495495
prevent that. A simple implementation would be:
496496

SECURITY.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ blocked instantly.
1212

1313
## Exceptions
1414

15-
If you do not receive an acknowledgement within the said time frame please give
15+
If you do not receive an acknowledgement within the said time frame, please give
1616
us the benefit of the doubt as it's possible that we haven't seen it yet. In
17-
this case please send us a message **without details** using one of the
17+
this case, please send us a message **without details** using one of the
1818
following methods:
1919

2020
- Contact the lead developers of this project on their personal e-mails. You can
21-
find the e-mails in the git logs, for example using the following command:
21+
find the e-mails in the git logs, for example, using the following command:
2222
`git --no-pager show -s --format='%an <%ae>' <gitsha>` where `<gitsha>` is the
2323
SHA1 of their latest commit in the project.
2424
- Create a GitHub issue stating contact details and the severity of the issue.
2525

26-
Once we have acknowledged receipt of your report and confirmed the bug ourselves
27-
we will work with you to fix the vulnerability and publicly acknowledge your
28-
responsible disclosure, if you wish. In addition to that we will create and
29-
publish a security advisory to
26+
Once we have acknowledged receipt of your report and confirmed the bug
27+
ourselves, we will work with you to fix the vulnerability and publicly
28+
acknowledge your responsible disclosure, if you wish. In addition to that, we
29+
will create and publish a security advisory to
3030
[GitHub Security Advisories](https://github.com/websockets/ws/security/advisories?state=published).
3131

3232
## History

doc/ws.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ This class represents a WebSocket server. It extends the `EventEmitter`.
103103
Create a new server instance. One and only one of `port`, `server` or `noServer`
104104
must be provided or an error is thrown. An HTTP server is automatically created,
105105
started, and used if `port` is set. To use an external HTTP/S server instead,
106-
specify only `server` or `noServer`. In this case the HTTP/S server must be
106+
specify only `server` or `noServer`. In this case, the HTTP/S server must be
107107
started manually. The "noServer" mode allows the WebSocket server to be
108108
completely detached from the HTTP/S server. This makes it possible, for example,
109109
to share a single HTTP/S server between multiple WebSocket servers.
@@ -112,8 +112,8 @@ to share a single HTTP/S server between multiple WebSocket servers.
112112
> authentication in the `'upgrade'` event of the HTTP server. See examples for
113113
> more details.
114114
115-
If `verifyClient` is not set then the handshake is automatically accepted. If it
116-
has a single parameter then `ws` will invoke it with the following argument:
115+
If `verifyClient` is not set, then the handshake is automatically accepted. If
116+
it has a single parameter, then `ws` will invoke it with the following argument:
117117

118118
- `info` {Object}
119119
- `origin` {String} The value in the Origin header indicated by the client.
@@ -124,19 +124,19 @@ has a single parameter then `ws` will invoke it with the following argument:
124124
The return value (`Boolean`) of the function determines whether or not to accept
125125
the handshake.
126126

127-
If `verifyClient` has two parameters then `ws` will invoke it with the following
128-
arguments:
127+
If `verifyClient` has two parameters, then `ws` will invoke it with the
128+
following arguments:
129129

130130
- `info` {Object} Same as above.
131131
- `cb` {Function} A callback that must be called by the user upon inspection of
132132
the `info` fields. Arguments in this callback are:
133133
- `result` {Boolean} Whether or not to accept the handshake.
134-
- `code` {Number} When `result` is `false` this field determines the HTTP
134+
- `code` {Number} When `result` is `false`, this field determines the HTTP
135135
error status code to be sent to the client.
136-
- `name` {String} When `result` is `false` this field determines the HTTP
136+
- `name` {String} When `result` is `false`, this field determines the HTTP
137137
reason phrase.
138-
- `headers` {Object} When `result` is `false` this field determines additional
139-
HTTP headers to be sent to the client. For example,
138+
- `headers` {Object} When `result` is `false`, this field determines
139+
additional HTTP headers to be sent to the client. For example,
140140
`{ 'Retry-After': 120 }`.
141141

142142
`handleProtocols` takes two arguments:
@@ -146,15 +146,15 @@ arguments:
146146
- `request` {http.IncomingMessage} The client HTTP GET request.
147147

148148
The returned value sets the value of the `Sec-WebSocket-Protocol` header in the
149-
HTTP 101 response. If returned value is `false` the header is not added in the
149+
HTTP 101 response. If returned value is `false`, the header is not added in the
150150
response.
151151

152-
If `handleProtocols` is not set then the first of the client's requested
152+
If `handleProtocols` is not set, then the first of the client's requested
153153
subprotocols is used.
154154

155155
`perMessageDeflate` can be used to control the behavior of [permessage-deflate
156156
extension][permessage-deflate]. The extension is disabled when `false` (default
157-
value). If an object is provided then that is extension parameters:
157+
value). If an object is provided, then that is extension parameters:
158158

159159
- `serverNoContextTakeover` {Boolean} Whether to use context takeover or not.
160160
- `clientNoContextTakeover` {Boolean} Acknowledge disabling of client context
@@ -171,8 +171,8 @@ value). If an object is provided then that is extension parameters:
171171
above this limit will be queued. Default 10. You usually won't need to touch
172172
this option. See [this issue][concurrency-limit] for more details.
173173

174-
If a property is empty then either an offered configuration or a default value
175-
is used. When sending a fragmented message the length of the first fragment is
174+
If a property is empty, then either an offered configuration or a default value
175+
is used. When sending a fragmented message, the length of the first fragment is
176176
compared to the threshold. This determines if compression is used for the entire
177177
message.
178178

@@ -248,7 +248,7 @@ created internally. If an external HTTP server is used via the `server` or
248248
`noServer` constructor options, it must be closed manually. Existing connections
249249
are not closed automatically. The server emits a `'close'` event when all
250250
connections are closed unless an external HTTP server is used and client
251-
tracking is disabled. In this case the `'close'` event is emitted in the next
251+
tracking is disabled. In this case, the `'close'` event is emitted in the next
252252
tick. The optional callback is called when the `'close'` event occurs and
253253
receives an `Error` if the server is already closed.
254254

@@ -273,7 +273,7 @@ If the upgrade is successful, the `callback` is called with two arguments:
273273

274274
- `request` {http.IncomingMessage} The client HTTP GET request.
275275

276-
See if a given request should be handled by this server. By default this method
276+
See if a given request should be handled by this server. By default, this method
277277
validates the pathname of the request, matching it against the `path` option if
278278
provided. The return value, `true` or `false`, determines whether or not to
279279
accept the handshake.
@@ -305,12 +305,12 @@ This class represents a WebSocket. It extends the `EventEmitter`.
305305
tick. To improve compatibility with the WHATWG standard, the default value
306306
is `false`. Setting it to `true` improves performance slightly.
307307
- `finishRequest` {Function} A function which can be used to customize the
308-
headers of each http request before it is sent. See description below.
308+
headers of each HTTP request before it is sent. See description below.
309309
- `followRedirects` {Boolean} Whether or not to follow redirects. Defaults to
310310
`false`.
311311
- `generateMask` {Function} The function used to generate the masking key. It
312312
takes a `Buffer` that must be filled synchronously and is called before a
313-
message is sent, for each message. By default the buffer is filled with
313+
message is sent, for each message. By default, the buffer is filled with
314314
cryptographically strong random bytes.
315315
- `handshakeTimeout` {Number} Timeout in milliseconds for the handshake
316316
request. This is reset after every redirection.
@@ -343,7 +343,7 @@ context takeover.
343343

344344
for each HTTP GET request (the initial one and any caused by redirects) when it
345345
is ready to be sent, to allow for last minute customization of the headers. If
346-
`finishRequest` is set then it has the responsibility to call `request.end()`
346+
`finishRequest` is set, then it has the responsibility to call `request.end()`
347347
once it is done setting request headers. This is intended for niche use-cases
348348
where some headers can't be provided in advance e.g. because they depend on the
349349
underlying socket.
@@ -479,7 +479,7 @@ The number of bytes of data that have been queued using calls to `send()` but
479479
not yet transmitted to the network. This deviates from the HTML standard in the
480480
following ways:
481481

482-
1. If the data is immediately sent the value is `0`.
482+
1. If the data is immediately sent, the value is `0`.
483483
1. All framing bytes are included.
484484

485485
### websocket.close([code[, reason]])
@@ -610,7 +610,7 @@ state is `CONNECTING`.
610610

611611
### websocket.terminate()
612612

613-
Forcibly close the connection. Internally this calls [`socket.destroy()`][].
613+
Forcibly close the connection. Internally, this calls [`socket.destroy()`][].
614614

615615
### websocket.url
616616

@@ -631,12 +631,12 @@ given `WebSocket`.
631631

632632
### WS_NO_BUFFER_UTIL
633633

634-
When set to a non empty value, prevents the optional `bufferutil` dependency
634+
When set to a non-empty value, prevents the optional `bufferutil` dependency
635635
from being required.
636636

637637
### WS_NO_UTF_8_VALIDATE
638638

639-
When set to a non empty value, prevents the optional `utf-8-validate` dependency
639+
When set to a non-empty value, prevents the optional `utf-8-validate` dependency
640640
from being required.
641641

642642
## Error codes

0 commit comments

Comments
 (0)