2018-01-23 16:02:56 -08:00
|
|
|
import { Socket } from '../../src'
|
|
|
|
|
2018-03-02 08:34:10 -08:00
|
|
|
const USOCKET = 'usocket'
|
2018-01-23 16:02:56 -08:00
|
|
|
|
2018-02-03 13:33:25 -08:00
|
|
|
let socket = new Socket({path:USOCKET,name:'default-unix-socket'})
|
2018-01-23 16:02:56 -08:00
|
|
|
|
2018-02-03 13:33:25 -08:00
|
|
|
socket.test = 'at socket => '
|
2018-01-25 18:07:45 -08:00
|
|
|
|
|
|
|
socket.registerPacketProcessor(async function (packet) {
|
2018-02-12 14:41:06 -08:00
|
|
|
return new Promise((resolve) => {
|
|
|
|
packet.payload = 'overwrite default processor from instance '+ this.test + packet.payload
|
|
|
|
resolve(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)
|
|
|
|
})
|