https://github.com/stafyniaksacha/nuxt-poc-websockets
https://github.com/stafyniaksacha/nuxt-poc-websockets
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stafyniaksacha/nuxt-poc-websockets
- Owner: stafyniaksacha
- Created: 2022-10-01T12:03:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-01T12:41:08.000Z (over 2 years ago)
- Last Synced: 2025-03-26T21:23:09.644Z (3 months ago)
- Language: TypeScript
- Size: 58.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nuxt 3 Minimal Starter
Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more.
## Setup
Make sure to install the dependencies:
```bash
# pnpm
pnpm install --shamefully-hoist
```## Development Server
Start the development server on http://localhost:3000
```bash
npm run dev
```## Production
Build the application for production:
```bash
pnpm build
```Locally preview production build:
```bash
node ./start.mjs
```# Websocket
Create Client A
```bash
wscat -H "Authorization:Basic clientA" -c 'ws://[::]:33333'
```Create Client B
```bash
wscat -H "Authorization:Basic clientB" -c 'ws://[::]:33333'
```> **note**: install wscat with `npm i -g wscat`
Broadcast to all clients
```bash
curl http://localhost:3000/api/broadcast \
-XPOST \
-H "content-type: application/json" \
-d '{"message": "hello"}'
```