@@ -19,18 +19,41 @@ const kBuffers = Symbol('buffers');
19
19
const kError = Symbol ( 'error' ) ;
20
20
const kOwner = Symbol ( 'owner' ) ;
21
21
22
+ //
22
23
// We limit zlib concurrency, which prevents severe memory fragmentation
23
24
// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913
24
25
// and https://github.com/websockets/ws/issues/1202
25
26
//
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
+ //
28
29
let zlibLimiter ;
29
30
30
31
/**
31
- * Per-message Deflate implementation.
32
+ * permessage-deflate implementation.
32
33
*/
33
34
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
+ */
34
57
constructor ( options , isServer , maxPayload ) {
35
58
this . _maxPayload = maxPayload | 0 ;
36
59
this . _options = options || { } ;
@@ -51,6 +74,9 @@ class PerMessageDeflate {
51
74
}
52
75
}
53
76
77
+ /**
78
+ * @type {String }
79
+ */
54
80
static get extensionName ( ) {
55
81
return 'permessage-deflate' ;
56
82
}
0 commit comments