2018-01-23 16:02:56 -08:00
|
|
|
import { Socket } from '../../src'
|
|
|
|
|
|
|
|
const USOCKET = __dirname + '/test.sock'
|
|
|
|
|
|
|
|
let socket = new Socket(USOCKET,{name:'unix socket'})
|
|
|
|
|
2018-01-30 16:59:57 -08:00
|
|
|
socket.packet.test = 'at socket => '
|
2018-01-25 18:07:45 -08:00
|
|
|
|
|
|
|
socket.registerPacketProcessor(async function (packet) {
|
2018-01-30 16:59:57 -08:00
|
|
|
packet.payload = 'overwrite default processor from instance '+ this.test + packet.payload
|
2018-01-23 16:02:56 -08:00
|
|
|
return packet
|
2018-01-25 18:07:45 -08:00
|
|
|
})
|
2018-01-23 16:02:56 -08:00
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
|
|
|
await socket.create()
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
})
|