https://github.com/sxzz/unws
Unified WebSocket API for Node.js, Bun and modern browsers.
https://github.com/sxzz/unws
Last synced: 16 days ago
JSON representation
Unified WebSocket API for Node.js, Bun and modern browsers.
- Host: GitHub
- URL: https://github.com/sxzz/unws
- Owner: sxzz
- License: mit
- Created: 2023-04-19T10:30:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T12:47:11.000Z (24 days ago)
- Last Synced: 2025-04-02T08:12:41.375Z (23 days ago)
- Language: JavaScript
- Homepage:
- Size: 230 KB
- Stars: 32
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# unws [](https://npmjs.com/package/unws)
[](https://github.com/sxzz/unws/actions/workflows/unit-test.yml)
Unified WebSocket API for Node.js, Bun and [modern browsers](https://caniuse.com/websockets).
## Install
```bash
npm i unws
```## Usage
```ts
import { WebSocket } from 'unws'const ws = new WebSocket('ws://localhost:8080')
```> [!TIP]
> For Node.js v20.10.0 and above, the `WebSocket` global object is directly accessible without this package.
> See [here](https://nodejs.org/api/globals.html#websocket).## Sponsors
## License
[MIT](./LICENSE) License © 2023-PRESENT [三咲智子](https://github.com/sxzz)