lib/repl-socket-server.js
function start(config, setDefaultREPLCommands, getAppInstance) {

  // Defines the IPC socket file path
  var socketAddr = path.join(process.cwd(), 'socket-ctl');

  // Deletes the file if already exists
  if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);

  // Create and start the socket server
  socketServer = net.createServer(function(socket) {

    if(config.replStartMessage) socket.write(config.replStartMessage+"\n");

    // Instantiates a new REPL for this socket
    var socketReplServer = repl.start({
      prompt: config.promptSymbol,
      eval: replEvaluatorBuilder(getAppInstance()),
      input: socket,
      output: socket,
      writer: replWriter,
      terminal: true
    })
    .on("exit", () => {
      socket.end();
    });

    socket.on("error", (err) => {
      console.error(err);
    });

    socketReplServer.context.app = getAppInstance();

    setDefaultREPLCommands(socketReplServer);
  });
  socketServer.listen(socketAddr);
}
function start(config, setDefaultREPLCommands, getAppInstance) {

  // Defines the IPC socket file path
  var socketAddr = path.join(process.cwd(), 'socket-ctl');

  // Deletes the file if already exists
  if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);

  // Create and start the socket server
  socketServer = net.createServer(function(socket) {

    if(config.replStartMessage) socket.write(config.replStartMessage+"\n");

    // Instantiates a new REPL for this socket
    var socketReplServer = repl.start({
      prompt: config.promptSymbol,
      eval: replEvaluatorBuilder(getAppInstance()),
      input: socket,
      output: socket,
      writer: replWriter,
      terminal: true
    })
    .on("exit", () => {
      socket.end();
    });

    socket.on("error", (err) => {
      console.error(err);
    });

    socketReplServer.context.app = getAppInstance();

    setDefaultREPLCommands(socketReplServer);
  });
  socketServer.listen(socketAddr);
}
function start ( config , setDefaultREPLCommands , getAppInstance ) { // Defines the IPC socket file path var socketAddr = path . join ( process . cwd ( ) , 'socket-ctl' ) ; // Deletes the file if already exists if ( fs . existsSync ( socketAddr ) ) fs . unlinkSync ( socketAddr ) ; // Create and start the socket server socketServer = net . createServer ( function ( socket ) { if ( config . replStartMessage ) socket . write ( config . replStartMessage + "\n" ) ; // Instantiates a new REPL for this socket var socketReplServer = repl . start ( { prompt : config . promptSymbol , eval : replEvaluatorBuilder ( getAppInstance ( ) ) , input : socket , output : socket , writer : replWriter , terminal : true } ) . on ( "exit" , ( ) => { socket . end ( ) ; } ) ; socket . on ( "error" , ( err ) => { console . error ( err ) ; } ) ; socketReplServer . context . app = getAppInstance ( ) ; setDefaultREPLCommands ( socketReplServer ) ; } ) ; socketServer . listen ( socketAddr ) ; }
Starts an IPC socket server
Every new socket connection will be piped to a REPL
Starts an IPC socket server Every new socket connection will be piped to a REPL