Ranvier telnet is an event-based telnet server and socket package with GMCP support. Telnet commands are issued as events that you can handle as you please.
Requirements
Node >= 7
Usage
const Telnet = ;const server = { const telnetSocket = ; telnetSocket; telnetSocket;}netServer; server;
Events
<event name>(arguments)
data(Buffer input)
: Stream data that is not part of an IAC sequenceWILL/WONT/DO/DONT(number commandOpt)
: IAC command event, argument is the opt byte to the command, you can useRanvierTelnet.Options
or your own map of options.SUBNEG(number opt, Buffer buffer)
: Sent at completion ofIAC SB <OPT> [data] IAC SB
sequence.buffer
argument is aBuffer
of SB dataGMCP(string package, data)
: Sent on completion of GMCP data. See: https://www.gammon.com.au/gmcpunknownAction(number command, number opt)
: Some unknown IAC command was given
GMCP
As shown above you can receive GMCP data with the GMCP
event. To send GMCP data you can use the sendGMCP
method:
telnetSocket;
Executing other Telnet commands
If you want to execute other telnet commands, perhaps in response to a DO
or DONT
you can use the telnetCommand
method:
// inside some class somewherethisuseGMCP = false; telnetSocket; telnetSocket;