17 lines
379 B
JavaScript
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;
|
|
}
|