Skip to content

Commit

Permalink
[minor] Add JSDoc for PerMessageDeflate constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Nov 18, 2017
1 parent b4465f6 commit 0c8c0b8
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions lib/PerMessageDeflate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,41 @@ const kBuffers = Symbol('buffers');
const kError = Symbol('error');
const kOwner = Symbol('owner');

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

/**
* Per-message Deflate implementation.
* permessage-deflate implementation.
*/
class PerMessageDeflate {
/**
* Creates a PerMessageDeflate instance.
*
* @param {Object} options Configuration options
* @param {Boolean} options.serverNoContextTakeover Request/accept disabling
* of server context takeover
* @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge
* disabling of client context takeover
* @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the
* use of a custom server window size
* @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support
* for, or request, a custom client window size
* @param {Number} options.level The value of zlib's `level` param
* @param {Number} options.memLevel The value of zlib's `memLevel` param
* @param {Number} options.threshold Size (in bytes) below which messages
* should not be compressed
* @param {Number} options.concurrencyLimit The number of concurrent calls to
* zlib
* @param {Boolean} isServer Create the instance in either server or client
* mode
* @param {Number} maxPayload The maximum allowed message length
*/
constructor (options, isServer, maxPayload) {
this._maxPayload = maxPayload | 0;
this._options = options || {};
Expand All @@ -51,6 +74,9 @@ class PerMessageDeflate {
}
}

/**
* @type {String}
*/
static get extensionName () {
return 'permessage-deflate';
}
Expand Down

0 comments on commit 0c8c0b8

Please sign in to comment.