# websocket-broadcast

> Broadcasts received messages over websockets.

Latest version **3.0.3** (published 2020-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install websocket-broadcast
pnpm add websocket-broadcast
yarn add websocket-broadcast
bun add websocket-broadcast
```

Provides the command `websocket-broadcast`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2020-04-25 |
| First published | 2017-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Alberto Miranda |
| Maintainers | codealchemist |
| Keywords | websocket, broadcast |

## Links

- npm: https://www.npmjs.com/package/websocket-broadcast
- Repository: https://github.com/codealchemist/websocket-broadcast
- Homepage: https://github.com/codealchemist/websocket-broadcast#readme
- Issues: https://github.com/codealchemist/websocket-broadcast/issues
- npm.io page: https://npm.io/package/websocket-broadcast

## Dependencies (7)

- [ws](https://npm.io/package/ws.md) ^3.3.1
- [uuid](https://npm.io/package/uuid.md) ^3.0.1
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [clear](https://npm.io/package/clear.md) ^0.1.0
- [printii](https://npm.io/package/printii.md) ^1.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [cli-cursor](https://npm.io/package/cli-cursor.md) ^2.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.0.3 (latest) — 2020-04-25
- 3.0.2 — 2020-04-25
- 3.0.1 — 2020-04-25
- 3.0.0 — 2020-04-25
- 2.0.2 — 2018-08-01
- 2.0.1 — 2018-07-31
- 2.0.0 — 2018-07-06
- 1.2.0 — 2017-05-29
- 1.1.4 — 2017-05-12
- 1.1.3 — 2017-05-12
- 1.1.2 — 2017-05-07
- 1.1.1 — 2017-05-07
- 1.1.0 — 2017-05-07
- 1.0.0 — 2017-05-02

## README

# websocket-broadcast

Broadcasts received messages over websockets.

## Install

`npm install -g websocket-broadcast`

## How it works

It opens a websocket connection on port 3333.
Clients connected to this server can broadcast messages between them.
The client who sends a message doesn't receive it back, it's sent to the other clients only.

## Client IDs

After each clients connects it will get a
[UUID V1](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_.28date-time_and_MAC_address.29)
from **websocket-broadcast**.
Useful if you need to identify your clients with a unique ID.

UUID will be sent in a message with type `uuid`, something like this:

`{type: 'uuid', data: 'ed8ef0b0-35ff-11e7-8de4-6bd9049b7aa7'}`

When a client is disconnected a message will be sent as well:

`{type: 'disconnect', message: 'cya'}`

You can disable ID generation by setting the `--noid` modifier:

`websocket-broadcast --noid`

Note that disconnection messages won't be sent when `--noid` is set.

## Customize port

You can set a custom port by using the `-p` param:

`websocket-broadcast -p 8080`

## SSL support

If you need a secure connection (wss) simply pass your credential and key to use them:

`websocket-broadcast --cert /path/to/cert.pem --key path/to/key.pem`

## Logging

By default it will log every received message.

If you want to turn off logging you can use the `--nolog`:

`websocket-broadcast --nolog`

---
_Source: https://npm.io/package/websocket-broadcast · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
