Look at the nuxt 3 documentation to learn more.
Make sure to install the dependencies:
# pnpm
pnpm install --shamefully-hoist
Start the development server on http://localhost:3000
npm run dev
Build the application for production:
pnpm build
Locally preview production build:
node ./start.mjs
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"}'