mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-23 03:06:04 +02:00
Working WebSocket connections - not yet complete, but working well
This commit is contained in:
parent
3a41a6b2e1
commit
2e18833014
4 changed files with 177 additions and 50 deletions
|
@ -24,6 +24,8 @@ const ModuleInfo = exports.moduleInfo = {
|
|||
packageName : 'codes.l33t.enigma.telnet.server',
|
||||
};
|
||||
|
||||
exports.TelnetClient = TelnetClient;
|
||||
|
||||
//
|
||||
// Telnet Protocol Resources
|
||||
// * http://pcmicro.com/netfoss/telnet.html
|
||||
|
@ -498,54 +500,6 @@ function TelnetClient(input, output) {
|
|||
|
||||
this.input.on('data', this.dataHandler);
|
||||
|
||||
/*
|
||||
this.input.on('data', b => {
|
||||
bufs.push(b);
|
||||
|
||||
let i;
|
||||
while((i = bufs.indexOf(IAC_BUF)) >= 0) {
|
||||
|
||||
//
|
||||
// Some clients will send even IAC separate from data
|
||||
//
|
||||
if(bufs.length <= (i + 1)) {
|
||||
i = MORE_DATA_REQUIRED;
|
||||
break;
|
||||
}
|
||||
|
||||
assert(bufs.length > (i + 1));
|
||||
|
||||
if(i > 0) {
|
||||
self.emit('data', bufs.splice(0, i).toBuffer());
|
||||
}
|
||||
|
||||
i = parseBufs(bufs);
|
||||
|
||||
if(MORE_DATA_REQUIRED === i) {
|
||||
break;
|
||||
} else {
|
||||
if(i.option) {
|
||||
self.emit(i.option, i); // "transmit binary", "echo", ...
|
||||
}
|
||||
|
||||
self.handleTelnetEvent(i);
|
||||
|
||||
if(i.data) {
|
||||
self.emit('data', i.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(MORE_DATA_REQUIRED !== i && bufs.length > 0) {
|
||||
//
|
||||
// Standard data payload. This can still be "non-user" data
|
||||
// such as ANSI control, but we don't handle that here.
|
||||
//
|
||||
self.emit('data', bufs.splice(0).toBuffer());
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
this.input.on('end', () => {
|
||||
self.emit('end');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue