Package for simulating a WebSocket server and client entirely in the browser, useful for end-to-end testing without a real server. Current stable version is 1.0.9, updated on 2020-04-16, with low release cadence. Key differentiators: replaces native WebSocket for local simulation, enables testing and reverse engineering scenarios like WeChat DevTools communication. No further versions published recently.
npm install fake-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a fake WebSocket server and connecting a fake WebSocket client in the browser, exchanging messages.
Always use named imports or namespace imports to avoid accidentally overriding native WebSocket.
Migrate to mock-socket or ws (Node.js) for ongoing support.
Always instantiate with 'new'.
Use mock-socket if protocol support is needed.
Use: import { WebSocket } from 'fake-websocket'Check server URL matches client URL exactly, including protocol and port.
Ensure the URL is a valid WebSocket URL; fake-websocket does not connect to real servers, so any valid URL works.
Run: npm install fake-websocket
No dependency data recorded yet.