druid-net
v1.0.0
Published
TCP/IP event based library
Downloads
4
Readme
Druid-net
Simple node TCP-IP event manager
Getting started
Server :
const {Server} = require('druid-net')
const server = new Server()
server.on('anEvent',(client,data)=>{
// dont send to emitter
server.broadcast('anEvent',[data],[client])
// send to emitter
server.broadcast('anEvent',[data],)
})
// or do the same :
server.bridgeEvent('anEvent') // dont send to emitter
server.bridgeEvent('anEvent',true) // send to emitter
server.start()
Client :
const {Client} = require('druid-net')
const client = new Client()
// emit some
client.emit('anEvent',{some:'data'})
// recive some
client.on('anEvent',(data)=>{
// do what to do with data
})
client.connect()
TODO
- implements tests
- add some comments :D
- do the entire documentation :D
- correct the "hudge write" bug....
- add a systeme to recover client if he reconnect normally (ex : JWT to verify client)