# socket.io-kfk

> The kafka adapter for socket.io

Latest version **0.0.8** (published 2019-01-29) · MIT License license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2019-01-29 |
| First published | 2019-01-26 |
| Weekly downloads | 0 |
| License | MIT License |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 178 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | joway |
| Keywords | nodejs, kafka, socket.io |

## Links

- npm: https://www.npmjs.com/package/socket.io-kfk
- Repository: https://github.com/joway/socket.io-kfk
- Homepage: https://github.com/joway/socket.io-kfk#readme
- Issues: https://github.com/joway/socket.io-kfk/issues
- npm.io page: https://npm.io/package/socket.io-kfk

## Dependencies (5)

- [uid2](https://npm.io/package/uid2.md) 0.0.3
- [debug](https://npm.io/package/debug.md) 4.1.1
- [kafkajs](https://npm.io/package/kafkajs.md) ^1.4.7
- [notepack.io](https://npm.io/package/notepack.io.md) 2.2.0
- [socket.io-adapter](https://npm.io/package/socket.io-adapter.md) 1.1.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.8 (latest) — 2019-01-29
- 0.0.7 — 2019-01-29
- 0.0.6 — 2019-01-29
- 0.0.5 — 2019-01-29
- 0.0.4 — 2019-01-28
- 0.0.3 — 2019-01-28
- 0.0.2 — 2019-01-26
- 0.0.1 — 2019-01-26

## README

<img width="200px;" src="logo.png" />

# Socket.IO-KFK

## Usage

### Install

```shell
npm install -S socket.io-kfk
```

### Use Adapter

```js
import * as IO from 'socket-io'
import { initKafkaAdapter } from 'socket.io-kfk'

// create socket.io server
const server = http.createServer()
const io = IO(server)

// init kafka adapter
const opts = {
	brokerList: '127.0.0.1:9092',
	group: 'socketio-group',
	topic: 'socketio-topic',
}
const adapter = initKafkaAdapter(opts)

// register into socket.io instance
io.adapter(adapter)
```

## Why not socket-io.redis?

`socket.io-redis` is a easy and awesome adapter in socket.io ecology. But it use redis as its internal message queue, which have poor performance when have huge events. And redis cluster have a simple PUB/SUB implement: [current implementation will simply broadcast each published message to all other nodes](https://redis.io/topics/cluster-spec). It make us feel hard to expand our socket.io cluster with redis adapter.

So, for the reason of scalability, I write this kafka version to make socket.io can handle more than 100k events/s messages.

## License

[MIT](https://github.com/joway/socket.io-kfk/blob/master/LICENSE)

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