mirror of
https://github.com/LukeHagar/crossws.git
synced 2025-12-06 04:19:26 +00:00
1.1 KiB
1.1 KiB
Getting Started
CrossWS provides a cross-platform API to define well-typed WebSocket apps that can then be integrated into various WebSocket servers using built-in adapters.
Writing a realtime WebSocket server that can work in different javascript and WebSocket runtimes is challenging because there is no single standard for WebSocket servers. You often need to go into many details of diffrent API implementations and it also makes switching from one runtime costly. CrossWS is a solution to this!
Play Online
You can quickly try CrossWS online with unjs/h3 and unjs/listhen:
::callout{to="https://stackblitz.com/github/unjs/crossws/tree/main/examples/h3?file=app.ts"} Play online in Stackblitz ::
Installing Package
You can install crossws from npm:
::code-group
```sh [auto]
npx nypm i crossws
```
```sh [npm]
npm install crossws
```
```sh [Yarn]
yarn add crossws
```
```sh [pnpm]
pnpm add crossws
```
```sh [bun]
bun add crossws
```
::