Skip to content

Commit

Permalink
docs: add link to play online
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 29, 2024
1 parent 894792a commit ed41540
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/content/1.getting-started/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ CrossWS provides a cross-platform API to define well-typed WebSocket apps that c

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](https://h3.unjs.io) and [unjs/listhen](https://listhen.unjs.io):

::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](https://npmjs.com/crossws):
Expand Down
4 changes: 4 additions & 0 deletions docs/content/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ hero:
icon: "i-heroicons-rocket-launch"
to: "/getting-started"
size: lg
- label: "Play Online"
icon: "i-heroicons-play"
to: "https://stackblitz.com/github/unjs/crossws/tree/main/examples/h3?file=app.ts"
size: lg
- label: "Contribute on GitHub"
icon: "i-simple-icons-github"
color: "white"
Expand Down
4 changes: 3 additions & 1 deletion examples/h3/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ router.get(
),
);

// Listhen automatically sets up ws integration!
// Listhen automatically sets up integration!
// Learn more: https://crossws.unjs.io

export const websocket = defineWebSocketHooks({
open(peer) {
console.log("[ws] open", peer);
Expand Down

0 comments on commit ed41540

Please sign in to comment.