The `ws-parser` package provides a low-level stream parser specifically designed for WebSocket frames and messages. It is an internal component of the `whistle` debugging proxy and is explicitly *not* recommended for third-party application use. The current stable version is 0.6.4, last updated in February 2021. Given its specialized purpose and the explicit warning in its documentation, general developers should expect limited support, a lack of typical feature development, and potentially API choices optimized solely for its integration within `whistle`. It focuses on parsing raw WebSocket data, emitting events for parsed frames and complete messages, without providing a full WebSocket client/server implementation. Its release cadence is sporadic, tied to `whistle`'s needs, rather than a regular schedule.
npm install ws-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the `ws-parser` `Parser` class, feed it raw WebSocket frame buffers, and listen for emitted `frame` and `message` events, including basic error handling.
Avoid using this module directly in third-party applications. If you need a WebSocket parser, consider general-purpose libraries like `ws` (which has its own framing parser) or dedicated WebSocket protocol parsers designed for broader consumption.
Use `const Parser = require('ws-parser');` for importing the module in CommonJS environments. For ES Modules, if absolutely necessary, use `const Parser = require('ws-parser').Parser;` or consider dynamic `import('ws-parser').then(mod => new mod.Parser())` but be aware of the primary 'do not use' warning.Be aware that issues encountered may not be resolved. Consider contributing fixes upstream or forking the repository if critical updates are required for a `whistle`-dependent workflow. For independent projects, use a more actively maintained library.
In TypeScript/ESM, use `import Parser = require('ws-parser');` or `const Parser = require('ws-parser').Parser;` to correctly import the CommonJS class. Ensure your `tsconfig.json` or build setup handles CommonJS interoperability.Ensure you are creating an instance of the parser using `const parser = new Parser();` before attempting to call methods like `write()` or `end()` on it.
No dependency data recorded yet.