2.1.1 • Published 10 months ago

@mickl/socket.io-nats-emitter v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

socket.io-nats-emitter

socket.io-nats-emitter allows you to communicate with Socket.io servers easily without access to Socket.io

Emitter diagram

It must be used in conjunction with @mickl/socket.io-nats-adapter.

The current version is compatible with:

  • NATS.js 2.x, for NATS.js 1.x use @^1.0.0 of this package

If you have any issues or feature requests please create a pull request.

How to use

yarn add nats @mickl/socket.io-nats-emitter
import { connect } from 'nats';
import { NatsEmitter } from '@mickl/socket.io-nats-emitter';

const connection = await connect();
const io         = new NatsEmitter(connection);

// Emit
io.emit('event');

// Emit to room or socket-id
io.to('room').emit('event');

// Namespaces
const nspIo = io.of('/admin');
nspIo.emit('event');

License

MIT

1.1.0

10 months ago

2.1.1

10 months ago

2.1.0

10 months ago

1.0.1

4 years ago

1.0.0

4 years ago

2.0.0

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago