A small, dependency-free Node.js module providing enumerated WebSocket status codes as constants. Version 1.1.0 is the latest stable release. This library is agnostic to any WebSocket library and simply exports an object mapping human-readable names to numeric status codes (e.g., NORMAL_CLOSURE: 1000). It is inspired by the similar http-status module. It has no dependencies and supports CommonJS only. Suitable for both Node.js and browser environments (via bundler).
npm install websocket-event-codesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to require the module, use a specific code to close a WebSocket, and log all codes.
Use require() instead of import. For TypeScript, manually declare the module or use `const WebSocketEventCodes = require('websocket-event-codes');` with `@types/node`.Do not attempt to add or modify status codes on the exported object.
Only use codes 1000-1004, 1007-1014 for sending. Reserved codes (1005, 1006, 1015) are for internal use.
Consider manually adding missing codes or switching to a maintained alternative.
Ensure Node.js version supports require() for CJS. Use `const codes = require('websocket-event-codes');`Use CommonJS `require()` instead of `import`.
Double-check the require path and the property name. Use: `const codes = require('websocket-event-codes');` then `codes.NORMAL_CLOSURE`.No dependency data recorded yet.