Skip to content

MickL/socket.io-nats-emitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

bun 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published