23 lines
414 B
JavaScript
23 lines
414 B
JavaScript
|
import { Socket } from '../src'
|
||
|
|
||
|
const USOCKET = __dirname + '/sample.sock'
|
||
|
|
||
|
let socket = new Socket(USOCKET,{name:'unix socket'})
|
||
|
|
||
|
const app = {
|
||
|
spp: 'sprocessPacket',
|
||
|
sprocessPacket: async function (packet) {
|
||
|
packet.payload = 'processed '+packet.payload
|
||
|
return packet
|
||
|
}
|
||
|
}
|
||
|
|
||
|
;
|
||
|
(async () => {
|
||
|
|
||
|
await socket.create(app)
|
||
|
|
||
|
})().catch(err => {
|
||
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
||
|
})
|