@libsql/isomorphic-ws
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

@libsql/isomorphic-ws

This package provides WebSocket on Node (using ws) and in Deno and Cloudflare Workers (using the native WebSocket). Supports both CommonJS and ES modules.

import { WebSocket } from "@libsql/isomorphic-ws";

const ws = new WebSocket("ws://localhost:8080");
ws.onopen = (event) => {
    ws.send("Hello");
};
ws.onmessage = (event) => {
    console.log(event.data);
    ws.close();
};

Package Sidebar

Install

npm i @libsql/isomorphic-ws

Weekly Downloads

55,124

Version

0.1.5

License

MIT

Unpacked Size

2.43 kB

Total Files

7

Last publish

Collaborators

  • notrab
  • luciofranco
  • penberg