Vibeleaderboard
Index / tool
Visit github.com
Category
Developer Tools
Rank
No. 1021Tools index
Pricing
Open Source
Type
TOOL
Builder
wevm
GitHub
58 stars
Latest release
isows@1.0.7
Date

About

Isomorphic WebSocket implementation that works in both browser and Node.js environments.

What it does

It gives application code one WebSocket constructor. At startup, it selects a native implementation when available and otherwise uses the ws package.

Why it's ranked here

This is a focused compatibility layer with credible coverage. Its test matrix exercises Node.js, Bun, Deno, Vite, SvelteKit, Next.js, and TypeScript compilation, while its build emits both major JavaScript module formats.

What's good

The implementation stays small and understandable. It checks several common global locations for native support, provides a native-only entry, emits declaration maps, and validates real connections across runtimes and frameworks.

Tradeoffs

Its narrow scope is also its limit. The exposed code selects a WebSocket implementation, but adds no documented reconnection, connection management, messaging protocol, or server API. Repository development also requires Bun.

How to use it well

Use it in shared JavaScript or TypeScript client code that must open sockets across browsers and server runtimes without maintaining separate imports. Pair it with your own retry, heartbeat, protocol, and state-management logic. Choose another package when you need a WebSocket server API.

Technical notes+

src/index.ts resolves getNativeWebSocket() first, then falls back to either WebSocket_.WebSocket or the ws module namespace. src/utils.ts probes WebSocket, global.WebSocket, window.WebSocket, and self.WebSocket, throwing when none exists. src/native.ts exposes only the native resolution path and re-exports a MessageEvent type alias. package.json builds CommonJS into src/_cjs, ES modules into src/_esm, and declarations into src/_types; scripts/prepublishOnly.ts removes the package-level type field before publication. Tests under test/bun, test/deno, test/node, test/vite, test/next, test/sveltekit, and test/tsc cover runtime, framework, and compiler integration.

Observed

License
MIT
Primary language
TypeScript
Install surface
npm package installable with npm, pnpm, or Bun
Interface
JavaScript and TypeScript library exporting a WebSocket constructor
Platform support
Node.js, Bun, Deno, and modern browsers
Module packaging
Builds CommonJS, ES modules, and TypeScript declarations
Integration coverage
Test workspaces include Node.js, Bun, Deno, Vite, SvelteKit, Next.js, and TypeScript compilation

Read from README.md, package.json, src/index.ts, src/utils.ts, src/native.ts, scripts/prepublishOnly.ts, test/bun/index.ts, test/tsc/index.ts, test/deno/index.ts, test/node/index.js, test/node/index.mjs, test/vite/src/main.ts, test/next/next-env.d.ts, test/next/next.config.js, test/next/src/app/page.tsx.

What it can do

  • Establish WebSocket connections in browser environments

    WebSocket URL and connection parametersActive WebSocket connection

  • Establish WebSocket connections in Node.js environments

    WebSocket URL and connection parametersActive WebSocket connection

  • Send real-time messages through WebSocket

    Message data (text, binary, or JSON)Transmitted message to WebSocket server

  • Receive real-time messages from WebSocket server

    Incoming WebSocket data streamParsed message data

  • Handle WebSocket connection events

    Connection state changes (open, close, error)Event callbacks and status updates

  • Provide unified WebSocket API across environments

    Same codebase for browser and Node.jsConsistent WebSocket functionality

Tags

websocketisomorphictypescript

Tech Stack

Node.jsTypeScript

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.