Using node -ncurses client-side server-side script?

I wrote a small node.js netServer chat application. I want to work on creating the ncurses user interface. The problem is that the chat application is written on the server side, and people connect via netcat, so the question is, how can I manipulate ncurses on the client side through it?

+6
ncurses
source share
3 answers

ncurses is a C library that you need to access to call its functions, so I don't think it can be used for your use.

I assume that by โ€œmanipulating ncursesโ€, what you really really are is a way to change the color of the text you write to users, moving up and down the screen, etc.

You may be able to achieve what you want by connecting your users through a telnet client, which, for example, supports ANSI escape codes. The answer to the simliar question for creating color codes is here .

+1
source share

You need a telnet (or ssh) server that is written as a NodeJS module.

He needs to understand the telnet protocol, which is richer than a simple character stream. (for example, it sends messages for terminal sizes (re) and many other events). http://en.wikipedia.org/wiki/Telnet - see RFC.

This is confusing because the telnet client is often used to connect to services that simply use simple character streams.

As far as I have found, there are no such working modules. Please correct me if you find him.

Netcat does not send information about terminal type, terminal size, or terminal events. All this is necessary for an application like ncurses.

+1
source share

You can write net.server by wrapping your node -ncurse server-side application, allowing telnet users to connect to the server, broadcast your application output to the connection, and connect it to your application.

 #!/usr/bin/env node /** * widget.js is in node-ncurses examples */ var net = require('net'), child = require('child_process'), bin = child.spawn('./widget.js', ['InputBox']); var server = net.createServer(function(c) { console.log('server connected'); c.on('end', function() { console.log('server disconnected'); }); c.pipe(bin.stdin); bin.stdout.pipe(c); }).listen(8124, function() { console.log('server bound 8124'); }); // and let users: // $ telnet localhost 8124 
0
source share

All Articles