Nuxt 3 Minimal Starter

Look at the nuxt 3 documentation to learn more.

Setup

Make sure to install the dependencies:

# pnpm
pnpm install --shamefully-hoist

Development Server

Start the development server on http://localhost:3000

npm run dev

Production

Build the application for production:

pnpm build

Locally preview production build:

node ./start.mjs

Websocket

Create Client A

wscat -H "Authorization:Basic clientA" -c 'ws://[::]:33333'

Create Client B

wscat -H "Authorization:Basic clientB" -c 'ws://[::]:33333'

note: install wscat with npm i -g wscat

Broadcast to all clients

curl http://localhost:3000/api/broadcast \
  -XPOST \
  -H "content-type: application/json" \
  -d '{"message": "hello"}'