#118: Crash on STDIO doors when logged in via WebSocket
This commit is contained in:
parent
95696912ed
commit
d5954f8198
|
@ -13,7 +13,7 @@ const WebSocketServer = require('ws').Server;
|
|||
const http = require('http');
|
||||
const https = require('https');
|
||||
const fs = require('graceful-fs');
|
||||
const EventEmitter = require('events');
|
||||
const Writable = require('stream');
|
||||
|
||||
const ModuleInfo = exports.moduleInfo = {
|
||||
name : 'WebSocket',
|
||||
|
@ -34,7 +34,7 @@ function WebSocketClient(ws, req, serverType) {
|
|||
// This bridge makes accessible various calls that client sub classes
|
||||
// want to access on I/O socket
|
||||
//
|
||||
this.socketBridge = new class SocketBridge extends EventEmitter {
|
||||
this.socketBridge = new class SocketBridge extends Writable {
|
||||
constructor(ws) {
|
||||
super();
|
||||
this.ws = ws;
|
||||
|
@ -48,6 +48,15 @@ function WebSocketClient(ws, req, serverType) {
|
|||
return this.ws.send(data, { binary : true }, cb);
|
||||
}
|
||||
|
||||
// we need to fake some streaming work
|
||||
unpipe() {
|
||||
Log.trace('WebSocket SocketBridge unpipe()');
|
||||
}
|
||||
|
||||
resume() {
|
||||
Log.trace('WebSocket SocketBridge resume()');
|
||||
}
|
||||
|
||||
get remoteAddress() {
|
||||
// Support X-Forwarded-For and X-Real-IP headers for proxied connections
|
||||
return (self.proxied && (req.headers['x-forwarded-for'] || req.headers['x-real-ip'])) || req.connection.remoteAddress;
|
||||
|
|
Loading…
Reference in New Issue