truss/comm/socket.net.js
2019-03-05 19:21:09 -06:00

17 lines
379 B
JavaScript

import {createConnection, createServer} from 'net';
const port = process.env.DISPATCHER_PORT || 43170;
export function client(address) {
return createConnection(port, address);
}
export function server() {
const server = createServer();
const originalListen = server.listen;
server.listen = () => {
return originalListen.call(server, port);
}
return server;
}