I wrote a small node.js netServer chat application. I want to work on creating an ncurses user-interface for it. Problem is, the chat application is written server-side, and people connect via netcat, so the question is how I would go about manipulating ncurses on the client-side through it?
js application. In client-side we mainly deal with DOM or web APIs like cookies, but these things don't exist in Node. Other reasons why we cannot use node modules at the client side is that the node uses the CommonJS module system while the browser uses standard ES Modules which has different syntax.
Node. js is an application runtime environment that enables using JavaScript (that used to be a client-side programming language) for building server-side applications that have access to the operating system, file system, and everything else to be fully-functional.
On the client side, the user is allowed to access the code written after verifying the user's need. Server-side scripting allows the back-end developer to hide the source code from the user. The client-side does not need any interaction with the server.
Yes, and yes. Node and Apache / PHP can co-exist on a single server. The only issue you are likely to run into is that they cannot both listen on the same port. HTTP, by default, runs on port 80 and only one process can "listen" on a single port at any one time.
What you need is a telnet (or ssh) server which is written as a NodeJS module.
It needs to understand the telnet protocol, which is richer than a simple character stream. (e.g. it sends messages for terminal (re)sizes and many other events). http://en.wikipedia.org/wiki/Telnet - see the RFCs.
This is confusing because the telnet client is often used to connect to services which just use plain character streams.
As far as I have found, there are no such working modules. Please correct me if you find one.
Netcat does not send any information on terminal type, terminal size or terminal events. These are all necessary for an ncurses-type application.
ncurses is a C library that you need to link to in order to call it functions so I don't think its what you can use for your use case.
I'm guessing that by "manipulating ncurses" what you are really after is a way to change the colour of text you are writing to the users, moving up and down the screen, etc.
You maybe able to achieve some of what you want by getting your users to connect via a telnet client that supports ANSI color escape codes for example. Answer to simliar question for producing colour codes here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With