node-ipc/test/TCP/TCPClient.js

36 lines
525 B
JavaScript
Raw Normal View History

2021-07-03 07:35:02 +10:00
import ipc from '../../node-ipc.js';
import process from 'process';
const dieAfter = 30e3;
function killClientProcess(){
process.exit(0);
}
setTimeout(
killClientProcess,
dieAfter
);
ipc.config.id = 'tcpClient';
ipc.config.retry= 600;
ipc.config.silent=true;
ipc.config.networkPort=8500;
ipc.connectToNet('tcpClient');
ipc.of.tcpClient.on(
'message',
function(data){
if(data.type=='END'){
killClientProcess();
}
}
)
export {
dieAfter as default,
dieAfter
}