# micro-ws

> A parody of zeit/micro for WebSockets.

Latest version **0.1.0** (published 2018-12-03) · 0 weekly downloads

## Install

```sh
npm install micro-ws
pnpm add micro-ws
yarn add micro-ws
bun add micro-ws
```

Provides the command `micro-ws`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-12-03 |
| First published | 2018-12-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jamen Marz |
| Maintainers | jamen |

## Links

- npm: https://www.npmjs.com/package/micro-ws
- npm.io page: https://npm.io/package/micro-ws

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) 6.1.2
- [mri](https://npm.io/package/mri.md) 1.1.1
- [micro](https://npm.io/package/micro.md) 9.3.3

## Recent versions

- 0.1.0 (latest) — 2018-12-03

## README

# micro-ws

A parody of [`zeit/micro`](https://github.com/zeit/micro) for WebSockets.

## Example

```js
const { event, send } = require('micro-ws')

module.exports = async (conn) => {
    const { name, data } = await event(conn)

    if (name === 'hello') {
        return send(conn, 'hello', { foo: 1 })
    }
}
```

I've forked the command-line code from `micro`, so it is similar:

```sh
micro-ws server.js --listen tcp://0.0.0.0:3001
```

## TODO

I'm building this library to my needs in my projects, but I'm open to suggestions. Some ideas include:

- Hosting a joint HTTP + WS server (using micro for HTTP interface).
- Add more comprehensive functions for streamed messages.
- Explore alternatives to `ws` for driving the WebSockets.

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