Skip to content

Commit 0c8c0b8

Browse files
committed
[minor] Add JSDoc for PerMessageDeflate constructor
1 parent b4465f6 commit 0c8c0b8

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

lib/PerMessageDeflate.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,41 @@ const kBuffers = Symbol('buffers');
1919
const kError = Symbol('error');
2020
const kOwner = Symbol('owner');
2121

22+
//
2223
// We limit zlib concurrency, which prevents severe memory fragmentation
2324
// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913
2425
// and https://github.com/websockets/ws/issues/1202
2526
//
26-
// Intentionally global; it's the global thread pool that's
27-
// an issue.
27+
// Intentionally global; it's the global thread pool that's an issue.
28+
//
2829
let zlibLimiter;
2930

3031
/**
31-
* Per-message Deflate implementation.
32+
* permessage-deflate implementation.
3233
*/
3334
class PerMessageDeflate {
35+
/**
36+
* Creates a PerMessageDeflate instance.
37+
*
38+
* @param {Object} options Configuration options
39+
* @param {Boolean} options.serverNoContextTakeover Request/accept disabling
40+
* of server context takeover
41+
* @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge
42+
* disabling of client context takeover
43+
* @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the
44+
* use of a custom server window size
45+
* @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support
46+
* for, or request, a custom client window size
47+
* @param {Number} options.level The value of zlib's `level` param
48+
* @param {Number} options.memLevel The value of zlib's `memLevel` param
49+
* @param {Number} options.threshold Size (in bytes) below which messages
50+
* should not be compressed
51+
* @param {Number} options.concurrencyLimit The number of concurrent calls to
52+
* zlib
53+
* @param {Boolean} isServer Create the instance in either server or client
54+
* mode
55+
* @param {Number} maxPayload The maximum allowed message length
56+
*/
3457
constructor (options, isServer, maxPayload) {
3558
this._maxPayload = maxPayload | 0;
3659
this._options = options || {};
@@ -51,6 +74,9 @@ class PerMessageDeflate {
5174
}
5275
}
5376

77+
/**
78+
* @type {String}
79+
*/
5480
static get extensionName () {
5581
return 'permessage-deflate';
5682
}

0 commit comments

Comments
 (0)