# unix2ws

> Unix2WS allows you to easily stream data to Socket.IO clients

Latest version **0.0.6** (published 2015-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install unix2ws
pnpm add unix2ws
yarn add unix2ws
bun add unix2ws
```

Provides the command `unix2ws`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2015-09-14 |
| First published | 2014-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Louis Lambeau |
| Maintainers | llambeau |
| Keywords | pipe, fifo, unix, tcp, socket.io, websockets |

## Links

- npm: https://www.npmjs.com/package/unix2ws
- Repository: https://github.com/llambeau/Unix2WS.js
- Issues: https://github.com/llambeau/Unix2WS.js/issues
- npm.io page: https://npm.io/package/unix2ws

## Dependencies (3)

- [yargs](https://npm.io/package/yargs.md) ~1.0.15
- [socket.io](https://npm.io/package/socket.io.md) ^1.3.5
- [coffee-script](https://npm.io/package/coffee-script.md) 1.7.1

## 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

- 0.0.6 (latest) — 2015-09-14
- 0.0.5 — 2014-02-21
- 0.0.4 — 2014-02-21
- 0.0.3 — 2014-02-14
- 0.0.2-b — 2014-02-14
- 0.0.2 — 2014-02-14

## README

Unix2WS.js
==========

Unix2WS allows you to easily stream data from any input to socket.io.

This tool supports TCP, UNIX sockets as input, or named-pipe (FIFO)

## Installation

<pre>
  npm install -g unix2ws
</pre>

## Usage

The command line tool _unix2ws_ opens a socket.io server. Any content received through the specified source will be sent to all the Socket.IO clients.

I created this tool to be able to easily stream any line by line output from a command-line application to the browser.

By default, unix2ws will try to parse every line received as a JSON object.

<pre>
Usage: unix2ws

Examples:
  unix2ws -s 10001 --ws-port 10000
  unix2ws -s unix.sock --ws-port 10000
  unix2ws -f fifo --ws-port 10000


Options:
  -d, --debug        Prints debugging information     [default: false]
  -j, --json         Try to JSON.parse input lines    [default: true]
  -p, --ws-port      Port to use for socket.io        [default: 10000]
  -s, --from-socket  Opens TCP/UNIX socket for input
  -f, --from-fifo    Creates named pipe for input
</pre>

## Example

Open the example HTML file in your browser and give it a try, you'll see it's pretty simple

## Limitations

* It's at the moment impossible to create Unix FIFOs from node ([See this message on stackoverlow](http://stackoverflow.com/a/18226566)), I create it in a nasty way at the moment
* UNIX sockets & UNIX FIFOs are, of course, not supported on windows

## TODO

I'll probably add the following features in a near future:

* New parameter --event to specify the event name used to propagate the data (which is "data" at the moment)
* I'd like to add a new feature allowing me to give a node.js script as parameter, this script would expose a function receiving the socket object. I could therefore define (or reuse) some backend-side code (handshake, authentication, ...)

<pre>
module.exports = function(socket){
  socket.on("authenticate", function(data){
    return true;
  });
}
</pre>

* I have a lot of other ideas, but at the same time I think it would be cool to keep that tool simple and light

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