Registry / communication / permessage-deflate

permessage-deflate

JSON →
library0.1.7jsnpmunverified

Implements the permessage-deflate WebSocket protocol extension for compression of WebSocket messages. Version 0.1.7 is the latest stable release, last updated in 2018. It is designed as a plugin for the websocket-extensions library, providing per-message DEFLATE compression. Unlike alternative compression approaches, it follows the IETF hybi-permessage-compression draft and integrates seamlessly with the Faye WebSocket ecosystem. The package supports configuration of zlib compression levels, memory levels, strategies, context takeover, and window bits.

npm install permessage-deflate
INSTALL
IMPORT
SIG · PERMESSAGE-DEFLATE
P
permessage-deflate
communicationjavascriptv0.1.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

deflate
var deflate = require('permessage-deflate');
import deflate from 'permessage-deflate';
This package uses CommonJS and does not support ES module imports. Use require().
deflate.configure
var configured = require('permessage-deflate').configure({});
var configured = deflate.configure({});
Require the module first, then call .configure() on the returned object.
Extensions
var Extensions = require('websocket-extensions');
import { Extensions } from 'websocket-extensions';
The websocket-extensions package is CommonJS; use require().

Shows how to create a WebSocket extensions instance and add the permessage-deflate plugin for compression.

var Extensions = require('websocket-extensions'); var deflate = require('permessage-deflate'); var exts = new Extensions(); exts.add(deflate); // ... use exts with a WebSocket server or client
Debug
Known issues
breakingThe package uses CommonJS and will not work with ES module imports. Use require() instead of import.
fix
Replace import statements with const/var ... = require('permessage-deflate')
affects: >=0.1.0
deprecatedThe permessage-deflate specification may have changed; this implementation is based on an IETF draft and may not be fully compatible with RFC 7692.
fix
Consider using ws library's built-in permessage-deflate support if available
affects: >=0.1.0
gotchaThe configure method modifies the module's default instance; repeated calls may have side effects.
fix
Call configure() once and reuse the returned object, or create a clone
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'websocket-extensions'
Missing required peer dependency websocket-extensions.
fix
Run: npm install websocket-extensions
TypeError: require(...).configure is not a function
Calling .configure() after assigning the require result directly without parentheses.
fix
var deflate = require('permessage-deflate'); var configured = deflate.configure({});
TypeError: Extensions is not a constructor
Using import instead of require, or incorrect variable name.
fix
var Extensions = require('websocket-extensions'); var exts = new Extensions();
Upgrade
Version history
0.1.7latest on npm
Audit
Dependencies
websocket-extensionsrequiredRequired as a peer dependency for integrating the extension into WebSocket connections
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
permessage-deflate — npm install permessage-deflate · libregistry