Implement fake pipe() for WebSocket (doors/etc.)
This commit is contained in:
parent
be37fb0587
commit
3f34f77fcd
|
@ -31,7 +31,11 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.dataHandler = function(data) {
|
this.dataHandler = function(data) {
|
||||||
self.socketBridge.emit('data', data);
|
if(self.pipedDest) {
|
||||||
|
self.pipedDest.write(data);
|
||||||
|
} else {
|
||||||
|
self.socketBridge.emit('data', data);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -54,9 +58,14 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
return this.ws.send(data, { binary : true }, cb);
|
return this.ws.send(data, { binary : true }, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to fake some streaming work
|
pipe(dest) {
|
||||||
|
Log.trace('WebSocket SocketBridge pipe()');
|
||||||
|
self.pipedDest = dest;
|
||||||
|
}
|
||||||
|
|
||||||
unpipe() {
|
unpipe() {
|
||||||
Log.trace('WebSocket SocketBridge unpipe()');
|
Log.trace('WebSocket SocketBridge unpipe()');
|
||||||
|
self.pipedDest = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
resume() {
|
resume() {
|
||||||
|
|
Loading…
Reference in New Issue