WebSocket-Express v4.1.0 extends Express with WebSocket support via the ws library, providing a unified API for HTTP and WebSocket handling. Unlike express-ws, it avoids monkey-patching Express objects, fully supports async/await, transactions for reliable message delivery, and TypeScript types out of the box. Requires peer dependencies express@5.x and ws@8.x. Released under MIT license, actively maintained.
npm install websocket-expressNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an Express+WebSocket server with a simple echo endpoint. Shows import, router.ws, accept, and listening.
Upgrade to Express 5 and update any Express middleware to be compatible.
Switch to named imports.
Replace `res.reject()` with `res.abandon()` or `next()`.
Use `app.useHTTP(middleware)` for non-WebSocket-aware middleware.
Use `ws.nextMessage({ timeout: 5000 })` to set a timeout.Change to `import { WebSocketExpress } from 'websocket-express'` or use dynamic import with `import('websocket-express')`.Ensure correct import: `import { WebSocketExpress } from 'websocket-express'` then `const app = new WebSocketExpress();`Upgrade to v4.1.x and use `import { Router } from 'websocket-express'`.Run `npm install express ws @types/express @types/ws`.