uci-socket/test/socket.mjs

25 lines
441 B
JavaScript

import { Socket } from '../src'
const USOCKET = __dirname + '/sample.sock'
let socket = new Socket(USOCKET)
const app = {
uspp: 'sprocessPacket',
sprocessPacket: async function (packet) {
packet.processed = true
console.log('server: packet processed')
console.dir(packet)
return packet
}
}
;
(async () => {
await socket.create(app)
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})