socket.io-nats-emitter

0.1.1 • Public • Published

socket.io-nats-emitter

socket.io-nats-emitter allows you to communicate with socket.io servers through NATS easily from non-socket.io processes, based on the socket.io-emitter.

The socket.io servers instances should use this adapter socket.io-nats or one that implements the protocol.

How to use

var io = require('socket.io-nats-emitter')();
setInterval(function(){
  io.emit('time', new Date);
}, 5000);

API

Emitter(opts)

The following options are allowed:

  • key: the name of the key to pub/sub events on as prefix (socket.io)
  • delimiter: optional, channels delimiter
  • uid: optional, emitter identifier (emitter)
  • nc: optional, the nats client
  • ...: nats client options (ignored if nats client is supplied)

Emitter#to(room:String):Emitter

Emitter#in(room:String):Emitter

Specifies a specific room that you want to emit to.

Emitter#of(namespace:String):Emitter

Specifies a specific namespace that you want to emit to.

Readme

Keywords

Package Sidebar

Install

npm i socket.io-nats-emitter

Weekly Downloads

8

Version

0.1.1

License

MIT

Last publish

Collaborators

  • efmr