# net-socket.io

> Net-Socket.IO enables real-time, bidirectional and event-based communication for low-level IPC and TCP sockets. It is a small wrapper around node's [`net`](https://nodejs.org/api/events.html) library, that makes low-level socket programming easy.

Latest version **1.0.1** (published 2019-07-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install net-socket.io
pnpm add net-socket.io
yarn add net-socket.io
bun add net-socket.io
```

## 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 | 1.0.1 |
| Published | 2019-07-19 |
| First published | 2019-07-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 53.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sam Meech-Ward |
| Maintainers | meech-ward |
| Keywords | ipc, tcp, socket, unix, net |

## Links

- npm: https://www.npmjs.com/package/net-socket.io
- npm.io page: https://npm.io/package/net-socket.io

## Dependencies (1)

- [json-stream](https://npm.io/package/json-stream.md) ^1.0.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

- 1.0.1 (latest) — 2019-07-19
- 1.0.0 — 2019-07-17
- 0.1.1 — 2019-07-16
- 0.1.0 — 2019-07-16

## README

# Net Socket IO

Net-Socket.IO enables real-time, bidirectional and event-based communication for low-level IPC and TCP sockets. It is a small wrapper around node's [`net`](https://nodejs.org/api/events.html) library, that makes low-level socket programming easy.

Heavily Based on [socket.io](https://github.com/socketio/socket.io) and [Event Emitters](https://nodejs.org/api/events.html).

For more information on the motivation behind this library, check out my [blog post](https://sammeechward.com/net-socket-io/) on the subject.

## Examples

**server**

```js
const { Server } = require('net-socket.io');
const socketFile = '/tmp/socket'; // file for IPC socket, or port number for TCP socket.
const io = Server(socketFile);

io.on('connection', function(socket){
  socket.emit('request', /* */); // emit an event to the socket
  io.emit('broadcast', /* */); // emit an event to all connected sockets
  socket.on('reply', function(data){ /* */ }); // listen to the event
});
```

**client**

```js
const { Socket } = require('net-socket.io');
const socketFile = '/tmp/socket';
const socket = Socket(socketFile);

socket.on('ready', () => {
  socket.emit('request', /* */);
  socket.on('reply', (data) => { /* */ }); // listen to the event
});
```

Look in the [examples](https://github.com/meech-ward/net-socket.io/tree/master/examples) folder for complete examples.

## Documentation

Check out the [API documentation](https://github.com/meech-ward/net-socket.io/blob/master/docs/API.md) for more details.

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