Closed joeyparrish closed 1 year ago
@joeyparrish I'll need to look at linemode()
that may be left over from a direction I didn't end up taking (?!)
Take a look at how I use it in ENiGMA 1/2 BBS software here: https://github.com/NuSkooler/enigma-bbs/blob/master/core/servers/login/telnet.js as I capture keys.
This may also help you. I pasted it from a private repo for another project I'm using TelnetSocket in: https://gist.github.com/NuSkooler/dd89fb99aad34d7a4026fabffdb57f0e -- It's a cleaner version of what I do in enigma, which is capture all data and turn it in to key/ch events.
Let me know if that does the trick!
I'm not sure I understand. What I'm seeing is that I get a 'data' callback with a line of data instead of individual keys.
I wonder if this is what's getting you character mode:
this.socket.on('DO', command => {
switch (command.option) {
// ...
default:
return this.socket.command(Commands.WONT, command.option);
}
});
I didn't see anything about this event in the docs, so I don't think I would have known to try it. I'll try it tonight, though.
Ah, I found it. It's socket.will.sga()
that does the trick. I had socket.do.sga()
, but not will
.
Would you consider adding a note to the README about that? I could suggest one via PR if you prefer.
@joeyparrish Yep, happy to accept a PR, otherwise I can get to it soon!
Added a quick note to the README
I'm trying out telnet-socket for a MUD, and I find that the client waits to send entire lines. I would rather get each character, so I can manage the output in a certain way.
I tried the linemode() option, but it seems not to do anything. Looking at the implementation, it doesn't seem to be used. (But I'm new to the codebase, and I'm not 100% sure I understand how it works.)
Is linemode the thing I want? Is it hooked up? Thanks!