A server side TELNET stream protocol designed for games.


A server side TELNET stream implementation for node. This is intended for use creating a MUSH.

npm install sol-telnet
var net = require('net')
  , SolTelnet = require('sol-telnet');
server = net.createServer(function(sock) {
  SolTelnet.TelnetStream(sock, function(ts) {
    // Greet the player.
    ts.on('lineReceived', function(line) {
      console.log('Command: ', line);
    ts.on('MCCP2Activated', function() {
      console.log('This user activated compression. MCCP2');
    // The player resized their client.
    ts.on('windowSizeChange', function(width, height){})
    // The connection was closed.
    ts.on('end', function(){})

Appends a CR-LF to the end of your string and calls the send method for you.

ts.sendLine('Your corpse splatters on the wall.');

Sends a string out the stream. This will automatically escape any IAC characters and handle compressing the string if enabled.

ts.send("You swing…");

This event is emitted when a line of text is sent to the server from the client.

ts.on('lineReceived', function(line) {
  // Parse the line here...

This event is emitted if the client supports NAWS and they resize their client.

ts.on('windowSizeChange', function(width, height){
  // Window resized...

This event is emitted when the users client successfully enables the MCCP2 protocol. This protocol will gzip compress outgoing data sent from your server. Some game clients such as tintin++ support this.

ts.on('MCCP2Activated', function(){
  // User is using compression. Give them a buff… :)

This event is emitted when the server gets a request for an unhandled command.

This event is emitted when the server gets a sub negotiation it does not know how to handle.

This event is emitted when a client breaks RFC854. All CR characters must be followed by a NULL or a LF.