Registry / testing / ws-server-ftw

ws-server-ftw

JSON →
library0.1.3jsnpmunverified

A CLI tool for mocking WebSocket endpoints using a JSON or JS file. Version 0.1.3, low release cadence (last update years ago). Inspired by json-server, it serves data based on URL path traversing the provided object. Supports live data manipulation via stdin (resend, merge, deep-merge, append). No active development or maintenance. Ideal for quick prototyping but lacks modern features (no ESM, no TypeScript types, no WebSocket library flexibility).

npm install ws-server-ftw
INSTALL
IMPORT
SIG · WS-SERVER-FTW
W
ws-server-ftw
testingjavascriptv0.1.3
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.

default
npm install ws-server-ftw --save-dev
npm install ws-server-ftw --save
Intended as dev dependency for mocking
CLI
npx ws-server -i db.json
ws-server --input db.json
CLI is executed via npx; options use -i or --input
programmatic usage
const wsServer = require('ws-server-ftw');
import wsServer from 'ws-server-ftw';
Package does not export a programmatic API; only CLI. No ESM support.

Install the package, create a JSON file, start the mock WebSocket server, and connect a client to receive mocked data.

npm install ws-server-ftw --save-dev # Create db.json: echo '{"api":{"message":"hello"}}' > db.json # Start server on port 9704 npx ws-server -i db.json -p 9704 # In another terminal, connect via wscat or browser WebSocket to ws://localhost:9704/api/ # You will receive {"message":"hello"}
Debug
Known issues
breakingws-server-ftw uses ws v1.x as peer dependency, which may conflict with newer ws v2+ or v3+ projects.
fix
Install ws-server-ftw in a clean project or use npm ls to check ws version.
affects: >=0.1.0
deprecatedThe package uses Commander v2.x (deprecated; Commander v5+ required for some features).
fix
Pin commander to 2.x in your project if needed.
affects: >=0.1.0
gotchaProgrammatic API is not exported; only CLI. Developers often try to import it as a module.
fix
Use child_process.spawn or npx to invoke the CLI.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'ws'
ws-server-ftw does not bundle ws; it must be installed as a normal dependency.
fix
npm install ws
TypeError: commander is not a constructor
ws-server-ftw requires Commander v2.x, but a newer version is installed.
fix
npm install commander@2.11.0
ws-server: command not found
npx or global install missing.
fix
Use npx ws-server or install globally: npm install -g ws-server-ftw
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
wsrequiredWebSocket server implementation
commanderrequiredCLI argument parsing
chalkrequiredTerminal output coloring
strip-ansirequiredStrip ANSI codes from output
deepmergerequiredDeep merge utility for JSON data
Agent activity
18 hits · last 30 days
node
16
Resources
ws-server-ftw — npm install ws-server-ftw · libregistry