Shocked is a lightweight WebSocket server library for Node.js (not browser-compatible). Current stable version is 4.0.3, with infrequent releases. It provides a simple API for creating WebSocket servers, handling connections, and managing rooms/groups. Key differentiators: minimal dependencies, native WebSocket API, and built-in room management. However, it lacks advanced features like automatic reconnection or extensive documentation. Suitable for small to medium projects needing basic WebSocket functionality.
npm install shocked-serverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a WebSocket server on port 8080, echoes incoming text messages.
Convert your project to ESM (use import statements, set 'type':'module' in package.json) or use dynamic import() as a workaround.
Use the new callback-based API (e.g., connection.on('text', callback)) instead of EventEmitter methods.Check port availability before creating the server or wrap in try-catch.
Use connection.send(string) for text or convert binary to string. For binary, consider using the underlying ws library directly.
Change to import syntax or use dynamic import(). Example: const { Server } = await import('shocked-server');Use named import: import { Server } from 'shocked-server'Install ws: npm install ws