0.0.8 • Published 5 years ago

socket.io-kfk v0.0.8

Weekly downloads
4
License
MIT License
Repository
github
Last release
5 years ago

Socket.IO-KFK

Usage

Install

npm install -S socket.io-kfk

Use Adapter

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

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago