js-comint icon indicating copy to clipboard operation
js-comint copied to clipboard

connect to a socket REPL

Open velkyel opened this issue 8 years ago • 7 comments

is it possible to add connect to a socket REPL feature like in inf-clojure, please? There is possible to define inf-clojure-program like cons pair ("localhost" . 5555).

velkyel avatar Dec 01 '16 14:12 velkyel

what's socket REPL?

redguardtoo avatar Dec 01 '16 22:12 redguardtoo

do you know emacs commint file?

velkyel avatar Dec 02 '16 09:12 velkyel

No. Do you mean comint? What's the advantage to start a socket REPL?

redguardtoo avatar Dec 02 '16 11:12 redguardtoo

comint, sorry. "socket REPL" is now known name?

velkyel avatar Dec 02 '16 11:12 velkyel

Advantage? Running game with embedded js vm. Toying, scripting, debugging.

velkyel avatar Dec 02 '16 11:12 velkyel

How can I do that in NodeJS? Can you show me some prototype?

redguardtoo avatar Dec 02 '16 12:12 redguardtoo

like this:

var net = require('net');

var server = net.createServer(function(socket) {
    socket.setEncoding('utf8');
    socket.on('data', function(data) {
        var res = eval(data);
        socket.end(res.toString());
    });
});

server.listen(8000);

and run-js localhost:8000 in emacs.

I don't know nodejs too much -- actually I'd like to use js-comint mode to connect to my running app with embedded duktape (duktape.org) vm. This app listen and eval incoming data like example server.

velkyel avatar Dec 13 '16 15:12 velkyel